@@ -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;
@@ -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);
/*
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@gmail.com> --- refs.c | 8 ++------ refs.h | 2 ++ 2 files changed, 4 insertions(+), 6 deletions(-)