git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* [PATCH 00/23] Add reflog_expire() to the references API
@ 2014-12-04 23:08 Michael Haggerty
  2014-12-04 23:08 ` [PATCH 01/23] refs.c: make ref_transaction_create a wrapper for ref_transaction_update Michael Haggerty
                   ` (23 more replies)
  0 siblings, 24 replies; 63+ messages in thread
From: Michael Haggerty @ 2014-12-04 23:08 UTC (permalink / raw)
  To: Stefan Beller
  Cc: Jonathan Nieder, Junio C Hamano, Ronnie Sahlberg, git,
	Michael Haggerty

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

^ permalink raw reply	[flat|nested] 63+ messages in thread

end of thread, other threads:[~2014-12-12 18:57 UTC | newest]

Thread overview: 63+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-04 23:08 [PATCH 00/23] Add reflog_expire() to the references API Michael Haggerty
2014-12-04 23:08 ` [PATCH 01/23] refs.c: make ref_transaction_create a wrapper for ref_transaction_update Michael Haggerty
2014-12-04 23:08 ` [PATCH 02/23] refs.c: make ref_transaction_delete " Michael Haggerty
2014-12-04 23:08 ` [PATCH 03/23] refs.c: add a function to append a reflog entry to a fd Michael Haggerty
2014-12-04 23:08 ` [PATCH 04/23] expire_reflog(): remove unused parameter Michael Haggerty
2014-12-04 23:20   ` Jonathan Nieder
2014-12-04 23:28   ` Jonathan Nieder
2014-12-05 12:43     ` Michael Haggerty
2014-12-04 23:08 ` [PATCH 05/23] expire_reflog(): rename "ref" parameter to "refname" Michael Haggerty
2014-12-04 23:44   ` Jonathan Nieder
2014-12-04 23:08 ` [PATCH 06/23] expire_reflog(): exit early if the reference has no reflog Michael Haggerty
2014-12-04 23:48   ` Jonathan Nieder
2014-12-04 23:53   ` Jonathan Nieder
2014-12-05 15:10     ` Michael Haggerty
2014-12-04 23:08 ` [PATCH 07/23] expire_reflog(): use a lock_file for rewriting the reflog file Michael Haggerty
2014-12-05  0:23   ` Jonathan Nieder
2014-12-05  2:19     ` Stefan Beller
2014-12-08 10:07       ` Michael Haggerty
2014-12-09 18:47         ` Junio C Hamano
2014-12-09 18:54           ` Jeff King
2014-12-05 19:18     ` Stefan Beller
2014-12-05 19:32       ` Junio C Hamano
2014-12-05 19:41         ` Stefan Beller
2014-12-05 20:55           ` Junio C Hamano
2014-12-08 14:05     ` Michael Haggerty
2014-12-05  2:59   ` ronnie sahlberg
2014-12-08 10:40     ` Michael Haggerty
     [not found]   ` <CAN05THTTba-1n12hBszJAU-O+wsbSFd5Lt+kMk7_MU_0C=wZGQ@mail.gmail.com>
2014-12-05 17:47     ` Stefan Beller
2014-12-04 23:08 ` [PATCH 08/23] Extract function should_expire_reflog_ent() Michael Haggerty
2014-12-08 22:33   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 09/23] expire_reflog(): extract two policy-related functions Michael Haggerty
2014-12-05 19:02   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 10/23] expire_reflog(): add a "flags" argument Michael Haggerty
2014-12-08 22:35   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 11/23] expire_reflog(): move dry_run to flags argument Michael Haggerty
2014-12-08 22:38   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 12/23] expire_reflog(): move updateref " Michael Haggerty
2014-12-08 22:42   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 13/23] Rename expire_reflog_cb to expire_reflog_policy_cb Michael Haggerty
2014-12-08 22:46   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 14/23] struct expire_reflog_cb: a new callback data type Michael Haggerty
2014-12-08 22:49   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 15/23] expire_reflog(): pass flags through to expire_reflog_ent() Michael Haggerty
2014-12-08 22:55   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 16/23] expire_reflog(): move verbose to flags argument Michael Haggerty
2014-12-08 22:56   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 17/23] expire_reflog(): move rewrite " Michael Haggerty
2014-12-08 22:58   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 18/23] Move newlog and last_kept_sha1 to "struct expire_reflog_cb" Michael Haggerty
2014-12-08 22:59   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 19/23] expire_reflog(): treat the policy callback data as opaque Michael Haggerty
2014-12-08 23:12   ` Stefan Beller
2014-12-04 23:08 ` [PATCH 20/23] reflog_expire(): new function in the reference API Michael Haggerty
2014-12-08 23:32   ` Stefan Beller
2014-12-12  8:23     ` Michael Haggerty
2014-12-12  8:50       ` Jeff King
2014-12-12 18:57         ` Junio C Hamano
2014-12-04 23:08 ` [PATCH 21/23] refs.c: remove unlock_ref/close_ref/commit_ref from the refs api Michael Haggerty
2014-12-04 23:08 ` [PATCH 22/23] lock_any_ref_for_update(): inline function Michael Haggerty
2014-12-08 23:34   ` Stefan Beller
2014-12-11  0:13     ` Michael Haggerty
2014-12-04 23:08 ` [PATCH 23/23] refs.c: don't expose the internal struct ref_lock in the header file Michael Haggerty
2014-12-04 23:47 ` [PATCH 00/23] Add reflog_expire() to the references API Junio C Hamano

Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).