summaryrefslogtreecommitdiff
path: root/patch-ids.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-04-07 11:09:12 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-04-07 11:09:12 -0700
commitb4ca1db968eb57d9cd869337bffa254e0b2c83bd (patch)
treefd771aca19a235e6c102ff46ac4b85f14fd4b9d2 /patch-ids.c
parentGit 1.6.6 (diff)
downloadtgif-b4ca1db968eb57d9cd869337bffa254e0b2c83bd.tar.xz
reflog --expire-unreachable: avoid merge-base computation
The option tells the command to expire older reflog entries that refer to commits that are no longer reachable from the tip of the ref the reflog is associated with. To avoid repeated merge_base() invocations, we used to mark commits that are known to be reachable by walking the history from the tip until we hit commits that are older than expire-total (which is the timestamp before which all the reflog entries are expired). However, it is a different matter if a commit is _not_ known to be reachable and the commit is known to be unreachable. Because you can rewind a ref to an ancient commit and then reset it back to the original tip, a recent reflog entry can point at a commit that older than the expire-total timestamp and we shouldn't expire it. For that reason, we had to run merge-base computation when a commit is _not_ known to be reachable. This introduces a lazy/on-demand traversal of the history to mark reachable commits in steps. As before, we mark commits that are newer than expire-total to optimize the normal case before walking reflog, but we dig deeper from the commits the initial step left off when we encounter a commit that is not known to be reachable. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'patch-ids.c')
0 files changed, 0 insertions, 0 deletions