Skip to content

Commit 021f494

Browse files
authored
Merge pull request libgit2#4124 from pks-t/pks/worktree-refs
refdb: catch additional per-worktree refs
2 parents 95248be + 6da6b42 commit 021f494

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

src/refdb_fs.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -365,12 +365,17 @@ static const char *loose_parse_symbolic(git_buf *file_content)
365365
return refname_start;
366366
}
367367

368+
/*
369+
* Returns whether a reference is stored per worktree or not.
370+
* Per-worktree references are:
371+
*
372+
* - all pseudorefs, e.g. HEAD and MERGE_HEAD
373+
* - all references stored inside of "refs/bisect/"
374+
*/
368375
static bool is_per_worktree_ref(const char *ref_name)
369376
{
370-
return strcmp("HEAD", ref_name) == 0 ||
371-
strcmp("FETCH_HEAD", ref_name) == 0 ||
372-
strcmp("MERGE_HEAD", ref_name) == 0 ||
373-
strcmp("ORIG_HEAD", ref_name) == 0;
377+
return git__prefixcmp(ref_name, "refs/") != 0 ||
378+
git__prefixcmp(ref_name, "refs/bisect/") == 0;
374379
}
375380

376381
static int loose_lookup(

0 commit comments

Comments
 (0)