🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #3719

[PATCH v2 4/5] notes: pass the repository to the ref glob helpers

#3719
From: Okhuomon Ajayi
Date: Tue, 24 Nov 2026 17:21
140 lines
15961 bytes
string_list_add_refs_by_glob() and
string_list_add_refs_from_colon_sep() walk refs in
the_repository. The caller already knows which repository
that is.

Take the repository as their first argument. Callers pass
the_repository for now.

Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
 notes-utils.c |  6 ++++--
 notes.c       | 21 +++++++++++++--------
 notes.h       |  6 ++++--
 3 files changed, 21 insertions(+), 12 deletions(-)

diff --git a/notes-utils.c b/notes-utils.c
index ea43fedd43..9f70366aa9 100644
--- a/notes-utils.c
+++ b/notes-utils.c
@@ -123,7 +123,8 @@ static int notes_rewrite_config(const char *k, const char *v,
 		/* note that a refs/ prefix is implied in the
 		 * underlying for_each_glob_ref */
 		if (starts_with(v, "refs/notes/"))
-			string_list_add_refs_by_glob(c->refs, v);
+			string_list_add_refs_by_glob(the_repository,
+						     c->refs, v);
 		else
 			warning(_("Refusing to rewrite notes in %s"
 				" (outside of refs/notes/)"), v);
@@ -160,7 +161,8 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
 	}
 	if (rewrite_refs_env) {
 		c->refs_from_env = 1;
-		string_list_add_refs_from_colon_sep(c->refs, rewrite_refs_env);
+		string_list_add_refs_from_colon_sep(the_repository, c->refs,
+						    rewrite_refs_env);
 	}
 	repo_config(the_repository, notes_rewrite_config, c);
 	if (!c->enabled || !c->refs->nr) {
diff --git a/notes.c b/notes.c
index 9d653c757a..ed6fc9a1c2 100644
--- a/notes.c
+++ b/notes.c
@@ -958,25 +958,27 @@ static int string_list_add_one_ref(const struct reference *ref, void *cb)
 /*
  * The list argument must have strdup_strings set on it.
  */
-void string_list_add_refs_by_glob(struct string_list *list, const char *glob)
+void string_list_add_refs_by_glob(struct repository *r,
+				  struct string_list *list, const char *glob)
 {
 	assert(list->strdup_strings);
 	if (has_glob_specials(glob)) {
 		struct refs_for_each_ref_options opts = {
 			.pattern = glob,
 		};
-		refs_for_each_ref_ext(get_main_ref_store(the_repository),
+		refs_for_each_ref_ext(get_main_ref_store(r),
 				      string_list_add_one_ref, list, &opts);
 	} else {
 		struct object_id oid;
-		if (repo_get_oid(the_repository, glob, &oid))
+		if (repo_get_oid(r, glob, &oid))
 			warning("notes ref %s is invalid", glob);
 		if (!unsorted_string_list_has_string(list, glob))
 			string_list_append(list, glob);
 	}
 }
 
-void string_list_add_refs_from_colon_sep(struct string_list *list,
+void string_list_add_refs_from_colon_sep(struct repository *r,
+					 struct string_list *list,
 					 const char *globs)
 {
 	struct string_list split = STRING_LIST_INIT_NODUP;
@@ -987,7 +989,7 @@ void string_list_add_refs_from_colon_sep(struct string_list *list,
 				     STRING_LIST_SPLIT_NONEMPTY);
 
 	for (i = 0; i < split.nr; i++)
-		string_list_add_refs_by_glob(list, split.items[i].string);
+		string_list_add_refs_by_glob(r, list, split.items[i].string);
 
 	string_list_clear(&split, 0);
 	free(globs_copy);
@@ -1002,7 +1004,8 @@ static int notes_display_config(const char *k, const char *v,
 	if (*load_refs && !strcmp(k, "notes.displayref")) {
 		if (!v)
 			return config_error_nonbool(k);
-		string_list_add_refs_by_glob(&display_notes_refs, v);
+		string_list_add_refs_by_glob(the_repository,
+					     &display_notes_refs, v);
 	}
 
 	return 0;
@@ -1133,7 +1136,8 @@ void load_display_notes(struct display_notes_opt *opt)
 		string_list_append_nodup(&display_notes_refs, default_notes_ref(the_repository));
 		display_ref_env = getenv(GIT_NOTES_DISPLAY_REF_ENVIRONMENT);
 		if (display_ref_env) {
-			string_list_add_refs_from_colon_sep(&display_notes_refs,
+			string_list_add_refs_from_colon_sep(the_repository,
+							    &display_notes_refs,
 							    display_ref_env);
 			load_config_refs = 0;
 		} else
@@ -1145,7 +1149,8 @@ void load_display_notes(struct display_notes_opt *opt)
 	if (opt) {
 		struct string_list_item *item;
 		for_each_string_list_item(item, &opt->extra_notes_refs)
-			string_list_add_refs_by_glob(&display_notes_refs,
+			string_list_add_refs_by_glob(the_repository,
+						     &display_notes_refs,
 						     item->string);
 	}
 
diff --git a/notes.h b/notes.h
index c81bc99446..520a816714 100644
--- a/notes.h
+++ b/notes.h
@@ -327,14 +327,16 @@ struct notes_tree **notes_tree_load(struct repository *r,
 /*
  * Add all refs that match 'glob' to the 'list'.
  */
-void string_list_add_refs_by_glob(struct string_list *list, const char *glob);
+void string_list_add_refs_by_glob(struct repository *r,
+				  struct string_list *list, const char *glob);
 
 /*
  * Add all refs from a colon-separated glob list 'globs' to the end of
  * 'list'.  Empty components are ignored.  This helper is used to
  * parse GIT_NOTES_DISPLAY_REF style environment variables.
  */
-void string_list_add_refs_from_colon_sep(struct string_list *list,
+void string_list_add_refs_from_colon_sep(struct repository *r,
+					 struct string_list *list,
 					 const char *globs);
 
 /* Expand inplace a note ref like "foo" or "notes/foo" into "refs/notes/foo" */
-- 
2.56.0
Technical Details
Message-ID: <20261124172146.18330-5-okhuomonajayi54@gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76237-linux-kernel-git=dewy.ru
References: <20261105203344.48513-1-okhuomonajayi54@gmail.com> <20261124172146.18330-1-okhuomonajayi54@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76237-linux-kernel-git=dewy.ru
From: okhuomonajayi54@gmail.com (Okhuomon Ajayi)
Newsgroups: linux.kernel.git
Subject: [PATCH v2 4/5] notes: pass the repository to the ref glob helpers
Date: Tue, 24 Nov 2026 18:21:45 +0100
Organization: Usenet Network
Message-ID: <20261124172146.18330-5-okhuomonajayi54@gmail.com>
References: <20261105203344.48513-1-okhuomonajayi54@gmail.com>
 <20261124172146.18330-1-okhuomonajayi54@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4189477"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:2Hc8hzFPGvpmaoZe5zXuTuuXgEs= sha256:pukpWvrUp8Xwopt/y/9fgql5kL/UfS0JrqQ2EF4LdOA=
	sha1:2/1LfTKCQESBf96gxNKIMvgLro4= sha256:K6xXRFTXryW/5zufDA6Te+MydDRiHdh4IgCwh9p6iq8=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 14C53125E2D; Tue, 24 Nov 2026 20:23:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.049
X-Spam-Status: No, score=-3.049 tagged_above=-9999 required=6.31
	tests=[DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1, DKIM_VALID=-0.1,
	DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id wO9UhsWochJ7;
	Tue, 24 Nov 2026 20:23:49 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76237-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id B4C95125E2B; Tue, 24 Nov 2026 20:23:40 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id 19D6E3E70F; Tue, 24 Nov 2026 17:23:39 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795541019;
	b=c/0umLPmSTHQHx3wsAKlnX/FgWEvPfSvcs9+Uf97zEpIMHWLdCYQNPJ5waExEW2ipsV9
	 uCiRwQsvv/Vhyf7YLLgnB29d2VpwQp60qym934T5JRwyg439bEUdu8jF8NQFUL99SCvDv
	 55QG2ND35BRo03+p/4sS64Q08Vnf8ekaMVl0A8kQzOpPLgDRRLzt/JyhfGALv/uD4I7Lh
	 /Z65NdgndeVux/gZ/fJ2L5oFiP7jZImdHnIP8Xg2TVCiMmbLtafMNZzIExB86FEuN7we0
	 QXxZpp++9197RFR3icfVtMeiDzb5Ln87Kh9iA9enej3U7NfvrFJKapvOWuoU8sFBNGw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795541019;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:In-Reply-To:
	 References:X-Mailing-List:List-Id:List-Post:List-Help:List-Subscribe:
	 List-Unsubscribe:List-Owner:Precedence:MIME-Version:
	 Content-Transfer-Encoding;
	bh=3Lqinj5lflroN7fs+EF52cJma0EJdMu3yWjlW5Eg+0Q=;
	b=goYpjPfEKlMWi8Fuev4cF8zKV/Q0D8xM07bhTKID7ckNg9kD8vw+e6YhNPY4HwX5mAT3
	 wthFitJwu/iIi1rgzCyx8xDTqu4AiNWdnnnGuT1ULR8JJShqIsm3qO1BdDS1Z72izKEvx
	 e9xtZjuEoUwDJNXbxMlNlcp2RCo0BgtZqR9+fzZnepaTkWB4OoLaa+JpTYP6xynUKNFPo
	 7qhlRpZTlm7Qsyg/Fd43Bw5oEIf5J00wmX64QUjWHRLixzgZkkpAtBuBxL0MWVGBAtY/b
	 ozDmHlli6PqWKo3I2vsLWZ7j8TzKmwmTEuWELLn5DGq93ranGxNflzdclgF2xzd2bBQ==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BbWSwumZ;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id E5996606A32E;
	Tue, 24 Nov 2026 17:23:38 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BbWSwumZ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.44
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795541018;
	b=x+g47qqPU7CqGAqeUyY6rUUbCuHZrO+d71Hap0xDiO4DzJV9tKjZnnWbwOfZVlmwDMt5
	 /Zkygn8TsSgXv7zwp3WxuDmyiCiWbkgncu7WAuRE4kyM+ftQihdi/FDRrosoHWbYKcTZy
	 blVap/mXqGomOyQ9vQuiU5/rKKYEiYH/YMgARjWPhb3Wyr6Pji/QhMpLY16p47diwLRsv
	 b6jo+oSCdCsJ2az78jZGjSRjudEv043YR69Xg2LNXKRoV4RglR7jZ8A8ZpREGKKRvH0iu
	 BrnOmCVKD49Bk1Aqy/FLZ78ljZ+vKqlExIaQoTo1QumH6CQKLUqgLPxjtq4DKQRbd+Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795541018;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version:
	 Content-Transfer-Encoding;
	bh=3Lqinj5lflroN7fs+EF52cJma0EJdMu3yWjlW5Eg+0Q=;
	b=qQCXJmn7/V0476P4KD8vRt1HbaAViPKi/uhrr1W8Y/c9KfJ6Gple6QGkn+dhVwwz8gnY
	 VaTpdUHI0v1H6FYArTkk8rdDR8LqfuTQtP3hMYGsy7DYBMBoLOnqD0v51WdyaT3avOXIc
	 QiTuyrnpVSMUBG+UwbxzqD07o17UuaX/l9wsCx8o/L/y1yNv2dG6/La1oONE7kuIn25k4
	 kf7hto3+Y4ySLWS9HMYGiP6CtbITFKri2pAr4d2PDZeIc1SEd0aRGRXphoCyx6adrPYrp
	 1KHnj8wBX1QuB6KzsSiY+QRS3NC6QxpFXMPRsYn5GSmWX1fLC9LfnkpCAem9+NYYuAA==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=BbWSwumZ;
	arc=none smtp.remote-ip=209.85.218.44
X-Received: from mail-ej1-f44.google.com (mail-ej1-f44.google.com [209.85.218.44])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B822F606A329
	for <git@vger.kernel.org>; Tue, 24 Nov 2026 17:23:37 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org B822F606A329
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-ej1-f44.google.com with SMTP id a640c23a62f3a-c4395d31228so817449466b.1
        for <git@vger.kernel.org>; Tue, 24 Nov 2026 09:23:37 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795541016; x=1796145816; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=3Lqinj5lflroN7fs+EF52cJma0EJdMu3yWjlW5Eg+0Q=;
        b=BbWSwumZ+YQ4ZNld+egTclqLqGDCw1K6VrAVb2xoXi7m6hp189/WUvxEg/aRxNbdqk
         N7/GkvRZmOGV/D66RSsO0HPWjNy7fKmsYzAFFaqhtKINBDHgDibnGzuuFY3KEoal1QF3
         IKf3LrvssIP7PwpQpjYR+LzTGi6TdPgJgCYIdjBN26rcGcJYJFaU15A2PjohSE4ewz7G
         3AFlCMKVZnRdGZ2Fw2u0Kdde1voJM8BaTXofE7QAdAR/A59+wI5P2xA1KaXP9lgjH4i1
         szJK8VkYhDyua/Sj9VZxrxV3vzrUX0q6ks2nzA/xaoEiXsQNQ0el5Y9Ux4+t56x1giu0
         m0Sw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795541016; x=1796145816;
        h=content-transfer-encoding:mime-version:references:in-reply-to
         :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from
         :to:cc:subject:date:message-id:reply-to:content-type;
        bh=3Lqinj5lflroN7fs+EF52cJma0EJdMu3yWjlW5Eg+0Q=;
        b=vjL9oFcywtferW6q03T9j3H6UONGY4Y90ShgRwrfJiXjWTplcJ3LRi+AREtgGFFGo1
         MqMp78IE5qI8PhSvULn1J0mKWG5JFBGNvIhCpBOoFTBx7RxxfActrSj6J9yvPE4ItieK
         U85c1lYRzHOkfcNb9pR94eAVHk9DpTExx5NU0cUIXzCw2hnmqgDwCBUmXUA0oYtOPQbc
         N59RhTWz2TY/WJRbj++UXSy3gxw8Z9CaS5T/Ffx4LIMII4m99ECjp7EcrE59Sc8hyE3S
         7oq9ut1INZOBsG2xd9Z7bL7KKO1N19YALK16rI+6vIw7KULauxSDrphyjcpm+vtR6jOT
         YP7w==
X-Gm-Message-State: APuU4Z9VhD22Gtowl8MwRtmX/vfqrlu/Gn/BEb2dhXfwwNeBYV9nxpmX
	kIgyg8PSGOjCNiG3M/TSKRsoxwToGvE66SWzIAnRb+l0dVyiXTfNSfrqjQMwhjO8kVE=
X-Gm-Gg: AZFdTZd4Qh7CvEW/YPEyqlcPnEfO7ux1EdPjnalj1NbTI6tJCWT5SgWlsdrWS4CDULj
	zzVZ+2xu1gmE3HtEf8hMtM+PkZCVK+cTCZQELEFQ/TiGpJK8is96JqlVYDYwXKToltIwByeteYP
	jGL0lm8/z9YszHMCc8Q8AOEN8eIXYS09eZg1GvECEU3tM/ezQlcAQscE7QC8VmYkV/Qt1zsYdKy
	JjyTwOwIDjnUB9jMV/yRgIw/IIekhyIlZp2kLd7Doh+AWcuzHRR83m0+F5Sl+w7uv5/0M0+sRA9
	OsudDDQzZfWTlcutRl17Yer+Z3NE60s1VLEyDwABw3JGKbb9kchh1wL/HrjdT+q+P7cE0hzQhGt
	YI6oyB1Fm4eKQ/x7uqMIp3nvncILuEejWArzICyPEhuYMaAiDQsYX5iO5Ahp9wm5pqn+U1oKZnc
	kO7DEVpKe6nwpf4UKaL1iPQYM2UVTyH3qCy1vI6hk3hQMv7UrWVluss6BzuciFfrsoCV9b93R0I
	1jZSnZjzBJiI6Gi9llHE2u2oce6/e3/tVCp001lReCtXhkR3Tvaqd2RVkEQKAl1B1JbkLE/b8F5
	rl+TN7UI72Ef2N/2Iv1mFmrwow11QwqjDpHGNskEkIp/YVTpAsrdvQxzzPcO9UZUKe8uHYXNXf9
	WeIPy4czq+xH7BHh367CcQctJSRfOc0jk1wkBvuzoa/DOs7xxhjfzVIj8vikHI21mbUBdnyXxVU
	gJnGPEjqA6c7vPEZA6R6fBljXH086x
X-Received: by 2002:a17:906:27cb:b0:c51:3acc:9f86 with SMTP id a640c23a62f3a-c513acca092mr1063013766b.39.1795541016060;
        Tue, 24 Nov 2026 09:23:36 -0800 (PST)
X-Received: from localhost.localdomain ([104.28.251.99])
        by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513afe01a0sm547394466b.68.2026.11.24.09.23.33
        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
        Tue, 24 Nov 2026 09:23:35 -0800 (PST)
X-Cc: christian.couder@gmail.com,
	ps@pks.im,
	usmanakinyemi202@gmail.com,
	siddharthasthana31@gmail.com,
	kaartic.sivaraam@gmail.com,
	okhuomonajayi54@gmail.com
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <20261124172146.18330-1-okhuomonajayi54@gmail.com>
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list