ref-filter: properly distinuish pseudo and root refs

The ref-filter interfaces currently define root refs as either a
detached HEAD or a pseudo ref. Pseudo refs aren't root refs though, so
let's properly distinguish those ref types.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Patrick Steinhardt
2024-05-15 08:51:05 +02:00
committed by Junio C Hamano
parent 993d57eded
commit f1701f279a
5 changed files with 31 additions and 27 deletions

18
refs.c
View File

@ -844,24 +844,8 @@ int is_per_worktree_ref(const char *refname)
starts_with(refname, "refs/rewritten/");
}
static int is_pseudo_ref(const char *refname)
int is_pseudo_ref(const char *refname)
{
/*
* Pseudorefs are refs that have different semantics compared to
* "normal" refs. These refs can thus not be stored in the ref backend,
* but must always be accessed via the filesystem. The following refs
* are pseudorefs:
*
* - FETCH_HEAD may contain multiple object IDs, and each one of them
* carries additional metadata like where it came from.
*
* - MERGE_HEAD may contain multiple object IDs when merging multiple
* heads.
*
* Reading, writing or deleting references must consistently go either
* through the filesystem (pseudorefs) or through the reference
* backend (normal ones).
*/
static const char * const pseudo_refs[] = {
"FETCH_HEAD",
"MERGE_HEAD",