File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -332,7 +332,8 @@ void reflog_expiry_prepare(const char *refname,
332332 if (!cb -> cmd .expire_unreachable || is_head (refname )) {
333333 cb -> unreachable_expire_kind = UE_HEAD ;
334334 } else {
335- commit = lookup_commit (the_repository , oid );
335+ commit = lookup_commit_reference_gently (the_repository ,
336+ oid , 1 );
336337 if (commit && is_null_oid (& commit -> object .oid ))
337338 commit = NULL ;
338339 cb -> unreachable_expire_kind = commit ? UE_NORMAL : UE_ALWAYS ;
Original file line number Diff line number Diff line change @@ -146,6 +146,14 @@ test_expect_success rewind '
146146 test_line_count = 5 output
147147'
148148
149+ test_expect_success ' reflog expire should not barf on an annotated tag' '
150+ test_when_finished "git tag -d v0.tag || :" &&
151+ git -c core.logAllRefUpdates=always \
152+ tag -a -m "tag name" v0.tag main &&
153+ git reflog expire --dry-run refs/tags/v0.tag 2>err &&
154+ test_grep ! "error: [Oo]bject .* not a commit" err
155+ '
156+
149157test_expect_success ' corrupt and check' '
150158
151159 corrupt $F &&
You can’t perform that action at this time.
0 commit comments