[PATCH 00/23] Add reflog_expire() to the references API

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I propose this patch series as an alternative to Ronnie's "reflog
transactions" series.

Both alternatives have been discussed exhaustively on the list [1,2].
My opinion is that there is no need to allow arbitrary reflog changes
via the ref_transaction API, because just about the only things we
want to do are

* Append an entry to a reflog when a reference is updated. This should
  (and is already) done as a side effect of the reference update.

* Expire or delete old reflog entries based on relatively complicated
  logic, possibly repairing the remaining entries so as to preserve
  the continuity of the reflog chain.

This patch series shows that the latter can be done with a single,
fairly simple, purpose-made function, expire_reflog(), in the
references API. The policy for what reflog entries should be expired
is specified by the caller via three callback functions that don't
have to know anything about how reflogs are stored. The locking,
iteration, repair, and writing is implemented within the references
module, in a function that can easily be swapped out when pluggable
reference backends are implemented.

The remaining reflog operations (enabling/disabling reflogs for a
reference, renaming the reflog when a reference is renamed) are not
especially difficult but will be brought into the same framework in a
future patch series.

The first few patches and the last few are taken from Ronnie's and
Stefan's work. I chose *not* to rename the ref_transaction functions
for obvious reasons. A couple of the later patches from their series
would make sense but are not duplicated here.

This branch is also available on GitHub:

    https://github.com/mhagger/git.git, branch reflog-expire-api-v1

Michael

[1] http://thread.gmane.org/gmane.comp.version-control.git/259712/focus=259770
[2] http://thread.gmane.org/gmane.comp.version-control.git/260731/focus=260767

Michael Haggerty (17):
  expire_reflog(): remove unused parameter
  expire_reflog(): rename "ref" parameter to "refname"
  expire_reflog(): exit early if the reference has no reflog
  expire_reflog(): use a lock_file for rewriting the reflog file
  Extract function should_expire_reflog_ent()
  expire_reflog(): extract two policy-related functions
  expire_reflog(): add a "flags" argument
  expire_reflog(): move dry_run to flags argument
  expire_reflog(): move updateref to flags argument
  Rename expire_reflog_cb to expire_reflog_policy_cb
  struct expire_reflog_cb: a new callback data type
  expire_reflog(): pass flags through to expire_reflog_ent()
  expire_reflog(): move verbose to flags argument
  expire_reflog(): move rewrite to flags argument
  Move newlog and last_kept_sha1 to "struct expire_reflog_cb"
  expire_reflog(): treat the policy callback data as opaque
  reflog_expire(): new function in the reference API

Ronnie Sahlberg (5):
  refs.c: make ref_transaction_create a wrapper for
    ref_transaction_update
  refs.c: make ref_transaction_delete a wrapper for
    ref_transaction_update
  refs.c: add a function to append a reflog entry to a fd
  refs.c: remove unlock_ref/close_ref/commit_ref from the refs api
  lock_any_ref_for_update(): inline function

Stefan Beller (1):
  refs.c: don't expose the internal struct ref_lock in the header file

 builtin/reflog.c | 259 ++++++++++++++++++++++---------------------------------
 refs.c           | 251 +++++++++++++++++++++++++++++++++++------------------
 refs.h           |  74 ++++++++++------
 3 files changed, 319 insertions(+), 265 deletions(-)

-- 
2.1.3

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux