reflog expire: do not punt on tags that point at non commits.
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>
Junio C Hamano committed
Dec 22, 2006 at 23:42 UTC
58748293f6fa450c6db89a78bd20aae7bf708d3b
1 file changed
+5
-5
builtin-reflog.c
+5
-5
@@ -80,7 +80,8 @@ static int expire_reflog_ent(unsigned char *osha1, unsigned char *nsha1,
80
goto prune;
81
82
if ((timestamp < cb->expire_unreachable) &&
83
- ((old && !in_merge_bases(old, cb->ref_commit)) ||
83
+ (!cb->ref_commit ||
84
+ (old && !in_merge_bases(old, cb->ref_commit)) ||
85
(new && !in_merge_bases(new, cb->ref_commit))))
86
goto prune;
87
@@ -126,10 +127,9 @@ static int expire_reflog(const char *ref, const unsigned char *sha1, int unused,
127
}
128
129
cb.ref_commit = lookup_commit_reference_gently(sha1, 1);
129
- if (!cb.ref_commit) {
130
- status = error("ref '%s' does not point at a commit", ref);
131
- goto finish;
132
- }
130
+ if (!cb.ref_commit)
131
+ fprintf(stderr,
132
+ "warning: ref '%s' does not point at a commit\n", ref);
133
cb.ref = ref;
134
cb.expire_total = cmd->expire_total;
135
cb.expire_unreachable = cmd->expire_unreachable;