It is unusual for a tag to point at a non-commit, and it is also
unusual for a tag to have reflog, but that is not an error and
we should still prune its reflog entries just as other refs.
Signed-off-by: Junio C Hamano <junkio@cox.net>
Older fsck-objects and prune did not protect commits in reflog
entries, and it is quite possible that a commit still exists in
the repository (because it was in a pack, or something) while
some of its trees and blobs are long gone. Make sure the commit
and its associated tree is complete and expire incomplete ones.
Signed-off-by: Junio C Hamano <junkio@cox.net>
This prepares a place to collect reflog management subcommands,
and implements "expire" action.
$ git reflog expire --dry-run \
--expire=4.weeks \
--expire-unreachable=1.week \
refs/heads/master
The expiration uses two timestamps: --expire and --expire-unreachable.
Entries older than expire time (defaults to 90 days), and entries older
than expire-unreachable time (defaults to 30 days) and records a commit
that has been rewound and made unreachable from the current tip of the
ref are removed from the reflog.
The parameter handling is still rough, but I think the
core logic for expiration is already sound.
Signed-off-by: Junio C Hamano <junkio@cox.net>