reflog --expire-unreachable: special case entries in "HEAD" reflog
commit03cb91b18cc7f9c19c053c97711f592cebddb5f4
authorJunio C Hamano <gitster@pobox.com>
Fri, 9 Apr 2010 20:20:02 +0000 (9 13:20 -0700)
committerJunio C Hamano <gitster@pobox.com>
Sun, 18 Apr 2010 01:23:19 +0000 (17 18:23 -0700)
tree0696f3d609022e8a469d4be7a78c0d4b188f2ac9
parent713c79e84bb148b8166d866755d155f64b270ac9
reflog --expire-unreachable: special case entries in "HEAD" reflog

"git reflog expire" (and "git gc") examines the reflog entries and
discards old/stale ones using two criteria.  The entries that are older
than "reflogexpire" (defaults to 90 days) are unconditionally removed, and
the entries that are older than "reflogexpireunreachable" (defaults to 30
days) are removed if the entry point at commits that are not reachable
from the value of the ref.

This is reasonable for local branches, remote tracking branches and tags.
You (or other people) may have failed experiments that have been made and
then later discarded by resetting the tip of the branch back, and setting
the value of "reflogexpireunreachable" shorter than that of "reflogexpire"
will prune the entries that describe these failed experiments earlier than
the entries that describe the steps that led to the current history.

It however doesn't make much sense for "HEAD" reflog.  When you switch
between branches, it is normal that the tip of the branch you were on is
not an ancestor of the branch you have switched to.  The moral equivalent
of expiring failed experiments in per-branch reflog for "HEAD" reflog is
to expire entries that talk about commits that cannot be reached from any
ref.

Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin-reflog.c