In normalize_glob_ref(), don't prefix patterns that look like pseudorefs with "refs/". This is in preparation for showing pseudorefs such as ORIG_HEAD in log decorations, as they are not matched as intended in decoration filters otherwise. Use existing function is_pseudoref_syntax() to do this, declaring it in refs.h to make it available to normalize_glob_ref() and anything else that might need it. As the function returns true for HEAD as well, the special case for that is no longer needed. Signed-off-by: Andy Koppe <andy.koppe@xxxxxxxxx> --- refs.c | 8 ++------ refs.h | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/refs.c b/refs.c index b03cccab909..492b9f7d4e5 100644 --- a/refs.c +++ b/refs.c @@ -564,12 +564,8 @@ void normalize_glob_ref(struct string_list_item *item, const char *prefix, if (prefix) strbuf_addstr(&normalized_pattern, prefix); else if (!starts_with(pattern, "refs/") && - strcmp(pattern, "HEAD")) + !is_pseudoref_syntax(pattern)) strbuf_addstr(&normalized_pattern, "refs/"); - /* - * NEEDSWORK: Special case other symrefs such as REBASE_HEAD, - * MERGE_HEAD, etc. - */ strbuf_addstr(&normalized_pattern, pattern); strbuf_strip_suffix(&normalized_pattern, "/"); @@ -840,7 +836,7 @@ int is_per_worktree_ref(const char *refname) starts_with(refname, "refs/rewritten/"); } -static int is_pseudoref_syntax(const char *refname) +int is_pseudoref_syntax(const char *refname) { const char *c; diff --git a/refs.h b/refs.h index 82aecd37a2b..b77691d787a 100644 --- a/refs.h +++ b/refs.h @@ -123,6 +123,8 @@ int should_autocreate_reflog(const char *refname); int is_branch(const char *refname); +int is_pseudoref_syntax(const char *refname); + int refs_init_db(struct strbuf *err); /* -- 2.42.GIT