Skip to content

Commit add416a

Browse files
peffgitster
authored andcommitted
checkout: don't confuse ref and object flags
When we are leaving a detached HEAD, we do a revision traversal to check whether we are orphaning any commits, marking the commit we're leaving as the start of the traversal, and all existing refs as uninteresting. Prior to commit 468224e, we did so by calling for_each_ref, and feeding each resulting refname to setup_revisions. Commit 468224e refactored this to simply mark the pending objects, saving an extra lookup. However, it confused the "flags" parameter to the each_ref_fn clalback, which is about the flags we found while looking up the ref with the object flag. Because REF_ISSYMREF ("this ref is a symbolic ref, e.g. refs/remotes/origin/HEAD") happens to be the same bit pattern as SEEN ("we have picked this object up from the pending list and moved it to revs.commits list"), we incorrectly reported that a commit previously at the detached HEAD will become unreachable if the only ref that can reach the commit happens to be pointed at by a symbolic ref. Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 468224e commit add416a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/checkout.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,7 @@ static int add_pending_uninteresting_ref(const char *refname,
592592
const unsigned char *sha1,
593593
int flags, void *cb_data)
594594
{
595-
add_pending_sha1(cb_data, refname, sha1, flags | UNINTERESTING);
595+
add_pending_sha1(cb_data, refname, sha1, UNINTERESTING);
596596
return 0;
597597
}
598598

0 commit comments

Comments
 (0)