Thread (59 messages) 59 messages, 8 authors, 2022-09-09

Re: [PATCH 1/3] refs: allow "HEAD" as decoration filter

From: Derrick Stolee <hidden>
Date: 2022-07-29 13:23:35

On 7/26/2022 11:10 AM, Ævar Arnfjörð Bjarmason wrote:
On Tue, Jul 26 2022, Derrick Stolee via GitGitGadget wrote:
quoted
 	if (prefix) {
 		strbuf_addstr(&normalized_pattern, prefix);
-	}
-	else if (!starts_with(pattern, "refs/"))
+	} else if (!starts_with(pattern, "refs/") &&
+		   strcmp(pattern, "HEAD"))
 		strbuf_addstr(&normalized_pattern, "refs/");
Arguably a digression for this series, but I think it would be very nice
to have a pre-step where we'd create some pre-step to centrally declare
these magical refs in some struct whose flags would cover these various
cases.

E.g. we have this hardcoded in should_autocreate_reflog(), in log-tree.c
(which AFAICT is the reference to "HEAD" here), refs.c etc. etc.
 
It's a good idea to collect our known ref namespaces into a
single place so we can update them together when a new feature
is added. This could help avoid the inconsistencies that already
exist (such as not filtering "HEAD" or not coloring "refs/notes/").

Thanks,
-Stolee
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help