git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Andy Koppe <andy.koppe@gmail.com>
To: git@vger.kernel.org
Cc: Andy Koppe <andy.koppe@gmail.com>
Subject: [PATCH 4/7] refs: separate decoration type from default filter
Date: Thu, 19 Oct 2023 20:39:08 +0100	[thread overview]
Message-ID: <20231019193911.1669705-5-andy.koppe@gmail.com> (raw)
In-Reply-To: <20231003205442.22963-1-andy.koppe@gmail.com>

Add 'include' bit to struct ref_namespace_info to determine whether a
ref namespace is to be included in the default decoration filters,
instead of using the decoration type for the purpose.

This is to allow adding ref namespaces that do have a decoration type
but that are not shown by default.

Signed-off-by: Andy Koppe <andy.koppe@gmail.com>
---
 builtin/log.c | 6 ++----
 refs.c        | 6 ++++++
 refs.h        | 4 ++++
 3 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/builtin/log.c b/builtin/log.c
index ba775d7b5cf..25d73c25697 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -227,10 +227,8 @@ static void set_default_decoration_filter(struct decoration_filter *decoration_f
 	 * populate with sensible defaults.
 	 */
 	for (i = 0; i < ARRAY_SIZE(ref_namespace); i++) {
-		if (!ref_namespace[i].decoration)
-			continue;
-
-		string_list_append(include, ref_namespace[i].ref);
+		if (ref_namespace[i].include)
+			string_list_append(include, ref_namespace[i].ref);
 	}
 }
 
diff --git a/refs.c b/refs.c
index fcae5dddc60..416c35f0c2f 100644
--- a/refs.c
+++ b/refs.c
@@ -70,14 +70,17 @@ struct ref_namespace_info ref_namespace[] = {
 		.ref = "HEAD",
 		.decoration = DECORATION_REF_HEAD,
 		.exact = 1,
+		.include = 1,
 	},
 	[NAMESPACE_BRANCHES] = {
 		.ref = "refs/heads/",
 		.decoration = DECORATION_REF_LOCAL,
+		.include = 1,
 	},
 	[NAMESPACE_TAGS] = {
 		.ref = "refs/tags/",
 		.decoration = DECORATION_REF_TAG,
+		.include = 1,
 	},
 	[NAMESPACE_REMOTE_REFS] = {
 		/*
@@ -87,6 +90,7 @@ struct ref_namespace_info ref_namespace[] = {
 		 */
 		.ref = "refs/remotes/",
 		.decoration = DECORATION_REF_REMOTE,
+		.include = 1,
 	},
 	[NAMESPACE_STASH] = {
 		/*
@@ -96,6 +100,7 @@ struct ref_namespace_info ref_namespace[] = {
 		.ref = "refs/stash",
 		.exact = 1,
 		.decoration = DECORATION_REF_STASH,
+		.include = 1,
 	},
 	[NAMESPACE_REPLACE] = {
 		/*
@@ -107,6 +112,7 @@ struct ref_namespace_info ref_namespace[] = {
 		 */
 		.ref = "refs/replace/",
 		.decoration = DECORATION_GRAFTED,
+		.include = 1,
 	},
 	[NAMESPACE_NOTES] = {
 		/*
diff --git a/refs.h b/refs.h
index 23211a5ea1c..4b054d30fe5 100644
--- a/refs.h
+++ b/refs.h
@@ -987,10 +987,14 @@ struct ref_namespace_info {
 	 * If 'exact' is true, then we must match the 'ref' exactly.
 	 * Otherwise, use a prefix match.
 	 *
+	 * If 'include' is true, the namespace is included in the
+	 * default decoration filters.
+	 *
 	 * 'ref_updated' is for internal use. It represents whether the
 	 * 'ref' value was replaced from its original literal version.
 	 */
 	unsigned exact:1,
+		 include:1,
 		 ref_updated:1;
 };
 
-- 
2.42.GIT



  parent reply	other threads:[~2023-10-19 19:40 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-03 20:54 [PATCH] decorate: add color.decorate.symbols config option Andy Koppe
2023-10-19 19:39 ` [PATCH 0/7] log: decorate pseudorefs and other refs Andy Koppe
2023-10-22  0:13   ` Junio C Hamano
2023-10-22 21:49     ` Andy Koppe
2023-10-23  0:20       ` Junio C Hamano
2023-10-23 22:15         ` Andy Koppe
2023-10-22 21:44   ` [PATCH v2 0/6] " Andy Koppe
2023-10-22 21:44     ` [PATCH v2 1/6] config: restructure color.decorate documentation Andy Koppe
2023-10-22 21:44     ` [PATCH v2 2/6] log: add color.decorate.symbol config variable Andy Koppe
2023-10-22 21:44     ` [PATCH v2 3/6] log: add color.decorate.ref " Andy Koppe
2023-10-22 21:44     ` [PATCH v2 4/6] refs: add pseudorefs array and iteration functions Andy Koppe
2023-10-22 21:44     ` [PATCH v2 5/6] refs: exempt pseudorefs from pattern prefixing Andy Koppe
2023-10-22 21:44     ` [PATCH v2 6/6] log: add color.decorate.pseudoref config variable Andy Koppe
2023-10-23 22:11     ` [PATCH v3 0/7] log: decorate pseudorefs and other refs Andy Koppe
2023-10-23 22:11       ` [PATCH v3 1/7] config: restructure color.decorate documentation Andy Koppe
2023-10-23 22:11       ` [PATCH v3 2/7] log: use designated inits for decoration_colors Andy Koppe
2023-10-23 22:11       ` [PATCH v3 3/7] log: add color.decorate.symbol config variable Andy Koppe
2023-10-23 22:11       ` [PATCH v3 4/7] log: add color.decorate.ref " Andy Koppe
2023-10-23 22:11       ` [PATCH v3 5/7] refs: add pseudorefs array and iteration functions Andy Koppe
2023-10-24  0:08         ` Junio C Hamano
2024-02-05 18:55         ` Kousik Sanagavarapu
2024-02-07 22:02           ` Junio C Hamano
2023-10-23 22:11       ` [PATCH v3 6/7] refs: exempt pseudorefs from pattern prefixing Andy Koppe
2023-10-23 22:11       ` [PATCH v3 7/7] log: add color.decorate.pseudoref config variable Andy Koppe
2023-10-19 19:39 ` [PATCH 1/7] config: restructure color.decorate documentation Andy Koppe
2023-10-19 19:39 ` [PATCH 2/7] log: use designated inits for decoration_colors Andy Koppe
2023-10-19 19:39 ` [PATCH 3/7] log: add color.decorate.symbol config option Andy Koppe
2023-10-19 19:39 ` Andy Koppe [this message]
2023-10-19 19:39 ` [PATCH 5/7] log: add color.decorate.ref option for other refs Andy Koppe
2023-10-19 19:39 ` [PATCH 6/7] refs: exempt pseudoref patterns from prefixing Andy Koppe
2023-10-19 19:39 ` [PATCH 7/7] log: show pseudorefs in decorations Andy Koppe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231019193911.1669705-5-andy.koppe@gmail.com \
    --to=andy.koppe@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).