🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #4002

[PATCH v7 5/6] notes: pass the repository to the ref glob helpers

#4002
From: Okhuomon Ajayi
Date: Fri, 27 Nov 2026 22:04
140 lines
15989 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 1cdf09c81c..f327652994 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 f4d1e31cd8..30adf0c197 100644
--- a/notes.h
+++ b/notes.h
@@ -331,14 +331,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: <20261127220445.45639-6-okhuomonajayi54@gmail.com>
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76553-linux-kernel-git=dewy.ru
References: <20261126213306.87466-1-okhuomonajayi54@gmail.com> <20261127220445.45639-1-okhuomonajayi54@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-wdc.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-76553-linux-kernel-git=dewy.ru
From: okhuomonajayi54@gmail.com (Okhuomon Ajayi)
Newsgroups: linux.kernel.git
Subject: [PATCH v7 5/6] notes: pass the repository to the ref glob helpers
Date: Fri, 27 Nov 2026 23:04:44 +0100
Organization: Usenet Network
Message-ID: <20261127220445.45639-6-okhuomonajayi54@gmail.com>
References: <20261126213306.87466-1-okhuomonajayi54@gmail.com>
 <20261127220445.45639-1-okhuomonajayi54@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="829167"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:E18+v02O6il2ZB2p6Nr/wpmLZS8= sha256:sdK4QX2BhzSZ0c9zrBgV0EAO77DopiqwvaK8ISBQfhU=
	sha1:6oMjz/d8JaicjdEjHOw0QZoUspc= sha256:Os7U2PvFDg3O5hpvK1pEcpWfS0uUM2EZbP828VX8ywo=
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 BCEC1125F66; Sat, 28 Nov 2026 01:05:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.049
X-Spam-Status: No, score=-2.049 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.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 7ubFaK-bTHBA;
	Sat, 28 Nov 2026 01:05:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-76553-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 tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id F1706125F6A; Sat, 28 Nov 2026 01:05:36 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 2AC642D95E; Fri, 27 Nov 2026 22:05:34 +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=1795817131;
	b=xL4zpW3vs5ms7Ku5boZYawO61enCAbS4tYoly/Dp4mhsNYy18mmAw1M4pMQOyVhHJDJi
	 vdgerQe8HK3NUbHFq+rYIEU8uoRSWf5YqrxIUyPiFZJPqGa6afaJWK5zQUp1Ea6Wx18E1
	 DgpaEfjNamGxxysILf7iHzYNcwFc4HYbWgNFOBSSRVw7GIW4egRGt1tMv8kqyHXFc99Uq
	 HJqWKl83s9b6tXdHtGLfej2JPcy9C87Vbp++JZWUNvU1ZNrnFsMYIPjWfZIG9JcB759ag
	 D0l3F+FxVmRVb0WrcGP+5qUYjQJSNvfuuxwA/IechV/TtiRrwn/GJesMfIkfC+PeHUA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795817131;
	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=k2PEMUormEjGD5YRY8k4J8gwbBReidjiqrhQUhyzUWI=;
	b=NKDvUNGEOHIwC8FuWk9uWfJT+8ZLcGQdJeAf1CWCx5TvkJDplfLZX+pOaNMsffMmb2aH
	 PC5bE5LFgqr/zZNpU9d/uao9K8y1mqhiwSUhwmJMzXJ973KC/EGgyt6ZhhmkETpwCXhFH
	 9XvMeL3WFV69NUYspGGvDc5C3snYeKpGtyjjMDb6o25l9a0cHfDJtFI8yWQ5EG4Td+lAG
	 35X9ESTVaxweg03CGZqRHSU56aRO+7Qey5byovUVfkEMZIWGMQ/UaAuGcCj9b+0hDMVqX
	 O7GngLDamXCRZch1kGe4i3p58ne9Ne2EDG0jjK1lDaHo6HdKup0LsJ4eBAcSuzRQfBw==
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=wPgtsVte;
	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 2F871606A337;
	Fri, 27 Nov 2026 22:05:31 +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=wPgtsVte
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.45
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795817130;
	b=eTKrR9xdWVDvgdFbr+kGQc7K6YWxxCWzWgdLLk9Pdi1xyrrOj09/Rz0b0+rFk0yTioQF
	 Edbt/yJ4nDH6qoTgt7MaSegAgy6uJ7j9L8hKZtVwkbwqW+d+2v5/m0kDhx0UTMkU5jpZF
	 ooCfy4QvwxeYmmqcFEV2Ameu5YCJ8lLsb9Qh6TKzg2aaDXXRIUxk11tlL7sMJ1zpNLzzT
	 PiCuXWMa2NCXC0JscZnxfeTN1V5lbniCIK7+oFR62Cxfp3+wmykmW74WEq1z63NcrV2BO
	 67v3lFP0G/ADE0LHszoIDH29LYAiAMsyIpT11dORF86XATb2WxfAKIC6nPhZixs2Jzw==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795817130;
	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=k2PEMUormEjGD5YRY8k4J8gwbBReidjiqrhQUhyzUWI=;
	b=fH4yHwMkjOwWo+je0Mnbok7SEBfKFcGDx9S4QNg5zH5hV4Pdh3EgMfHwzNYQgozNiqI6
	 em+OlxhHhD7ceFoKWupgVi8oBo9OQaDczAm44qTyLxRrK3GH1iJG0FXRlhzYTCcQC4dp3
	 dn3uZ6D7x33EYldxBiN6YfSPKk8nky9B2+HBPbTKoaMAx1YAMBNJBUEl1ZtEeY5VcgIp0
	 VpsAsiANrG++c6vEVI+QvavIsMIVvIEVIwv0WoKQqs6jaclu0yB/F4cqGjbeHgSl27vyw
	 qPh3BFsrJ+tTjkaimaKzEA6Ts32Li4i8ib9Dc7QoFXlA6Sdnfd0F9n2xnzQcHLn5Ufw==
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=wPgtsVte;
	arc=none smtp.remote-ip=209.85.221.45
X-Received: from mail-wr1-f45.google.com (mail-wr1-f45.google.com [209.85.221.45])
	(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 066CC606A32E
	for <git@vger.kernel.org>; Fri, 27 Nov 2026 22:05:29 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 066CC606A32E
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-wr1-f45.google.com with SMTP id ffacd0b85a97d-49412eb1474so5635754f8f.3
        for <git@vger.kernel.org>; Fri, 27 Nov 2026 14:05:29 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795817128; x=1796421928; 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=k2PEMUormEjGD5YRY8k4J8gwbBReidjiqrhQUhyzUWI=;
        b=wPgtsVtePr1KZ12mTTzKvFm03O51EmydvYwds1jzSn817G2ipWDhIadQPJg3scOTuI
         arngAo1YYnBPvHkD6Y0SZft3KoURRUVOzdGEtmIZ3LYyLu0N8iAZDUsxYgsJUxUAdGcw
         eB5/bqw+ksN2fL5RzS7XO8zNwfit47vy7Hi+BP8eizzzEBOMen8cKxjZ8zIOBRFoo3fD
         +w93mWUCmR3A/nKJDyutGMmjqC0HbYvOkJzTCbocAmZtBnXfNOf9jecUgtN63Le3VEWd
         qiRAB+yetQUiRskgPazc2utcryCSOZoQQvuZ1nF25w/wACrxSwlfGSBGMo0s+JHM/+pW
         BmPg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795817128; x=1796421928;
        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=k2PEMUormEjGD5YRY8k4J8gwbBReidjiqrhQUhyzUWI=;
        b=f8yIr46ASwNFhURBv50lBVBuDgcOkgIRqdsW/9MN3f2UcEbgIIbUK3GRAidZNtcF4k
         2aY84bPg6VkOVbw5BerzbRfH0WIIMW14s1JZwB/emdF7j4xQo55ZGWERcM9uL1QPIvlu
         h8y8Rdw/xGE61VryLh5gmVDmj180ht0Xnwz8LbMChz2P/LCt9UofIFn+ZFFycPeGJDBc
         ovv2T9+S+BcCKb1Ovxzb5hGTCkPK0k97cIYlPZ8DQM6me5xSKRH28+BEF0G+N7Fc8SZZ
         HJtfyKfsVSw3ZOSioMjlZEwEfuCpwaoN4mGmhPKWYIsjR/U/NbTprqFPfeNpYgQYMhp1
         ElqQ==
X-Gm-Message-State: APuU4Z+v/NvmQJPi88Vrr0yweeu78Fg/5B6WOtwC5sHLFh8x1Aqm2U8y
	zcOtIPyC2OP6GvWTm1wfHGwOEcQQ2BZvG4uCm9KtlhAABqUnJxa7SkdzYAtwoNlUaog=
X-Gm-Gg: AZFdTZexijGT/Klw/OgOV8O6CnztR0L3QrOyii/MLlTk8XsTfTOL5FzGxNaiqt6tPgA
	xOVWkZx0OfxBs8EIye9ucPPrVecGD7voJ6BwnGGpPNy19X/UfxGJhFon3cmE7cCtohdTrf8v0zq
	rsw1hYd7oTR0IgZCr7V5NXCiDDkWs9CwxtTrWTx6ZywJsZWNWwnIo2uk8/U7DnipMQYlooZtp7i
	xv+8gYUq4susDvFJ+zuq+CnavqGklkYi+9vyYzFFzW9pyXIFQz82ejkl1BRwnRoN+IJEylPm2/Y
	8XG9AwKb2QSo1uQZp7qIWCIu5DSW4BijaWstoqzNxjK2uSDnD4aqzYUkhNkEdTxd2Ik254fFc9u
	JcVPbEcN/bbSWKlyEZrlQKh8pORJBIDweim5S0T1Aher7CqBqw3a1f2rVVdJD5376rXaKB0z0As
	7ae59AJtDQoAC7WoV+/gCETJxCbriXcAGOozbTe66ZOrABIavhRPIv7dsG9QpvzR8nsob7pYxWS
	R0nMuE9BckUlpiHVp/p3rvehiXTJXS2/BJWkNWB1Vc5JFwHaVOW4I2MWzdhXH5e3YIax0bkpnnn
	Q7Je3e/uXDEZIv4HnotGo6FqWZkeeXZWnBOsOixu/sCgbBXYsiNM/r3GrjxgeEvBlwRTrW3p+g7
	WG7i/Y7V/2yr95hOsh4nYp+ynFPWCSaix60NMGNo6o7Y8lJlMWzYG0KsJKMGuLn9rZLsbo/EuFO
	BAvGTWSSfi8JEeArKooEa1p3TcQZdC
X-Received: by 2002:a05:6000:4812:b0:4a7:b8ab:df86 with SMTP id ffacd0b85a97d-4abb5db73bcmr47201185f8f.38.1795817128371;
        Fri, 27 Nov 2026 14:05:28 -0800 (PST)
X-Received: from localhost.localdomain ([104.28.251.98])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4ab658e2d1bsm51467422f8f.8.2026.11.27.14.05.24
        (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
        Fri, 27 Nov 2026 14:05:27 -0800 (PST)
X-Cc: christian.couder@gmail.com,
	ps@pks.im,
	gitster@pobox.com,
	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: <20261127220445.45639-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