Article View: linux.kernel.git
Article #3942[PATCH v6 5/6] notes: pass the repository to the ref glob helpers
From: Okhuomon Ajayi
Date: Thu, 26 Nov 2026 21:33
Date: Thu, 26 Nov 2026 21:33
140 lines
16018 bytes
16018 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:
<20261126213306.87466-6-okhuomonajayi54@gmail.com>Path:
mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76488-linux-kernel-git=dewy.ruReferences:
<20261124172146.18330-1-okhuomonajayi54@gmail.com> <20261126213306.87466-1-okhuomonajayi54@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76488-linux-kernel-git=dewy.ru
From: okhuomonajayi54@gmail.com (Okhuomon Ajayi)
Newsgroups: linux.kernel.git
Subject: [PATCH v6 5/6] notes: pass the repository to the ref glob helpers
Date: Thu, 26 Nov 2026 22:33:05 +0100
Organization: Usenet Network
Message-ID: <20261126213306.87466-6-okhuomonajayi54@gmail.com>
References: <20261124172146.18330-1-okhuomonajayi54@gmail.com>
<20261126213306.87466-1-okhuomonajayi54@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="570988"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:phZT/zE8k8kfc+DwsDFR3mJDUiQ= sha256:AUCMF4/cOVnlaobwNGp26Jb4mNWCEY/msFf+WcqlimA=
sha1:wLCzGgba36fFr5W6fzmi1h1wHNw= sha256:xXY8MVdgIXhHUjtG911Q5Tf8Fqr+D7HzUJ4xWON38+0=
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 E7A25125F0A; Fri, 27 Nov 2026 00:34:01 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
tests=[DCC_CHECK=1.1, 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 Gur-WHSePulg;
Fri, 27 Nov 2026 00:33:59 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76488-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 C9777125F0C; Fri, 27 Nov 2026 00:33:50 +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 5529A369AB; Thu, 26 Nov 2026 21:33:48 +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=1795728828;
b=Qpto3BBCaPBXX1VaJeKMLeChLLwWVwriQsXIT3ubK5wYfMlH+iO4hjTsyn7oS/WW7zZS
YpdmH9piScvzHnt0/am5ws2ZSy7dCKfNbOPhtEi8oK942mavp3SoIj+wgrzB+O5wDet27
0J65uFpvBAjjXaLANNMVA85Ge9KzwnNS1BtLcP1qJqusNm0QQandth5oISG4BREhsIgDm
DJ7ukZISGW/r26SPtvUTJ7DVbMjpy3aWkcGQA5klYmd2xrkUWpvNbTkfN9WyA2Z9QA7aD
23nE7GtQE2O4et9L9EQ8Kqc4qj/rAMjgOmnK6EIbJsE63V5Q6VPMHs+OYyxpBaokCLg==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795728828;
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=b3bmQkerozai3syBZcls28GRbkBPqpBJWu16y33cIvajtdtKde7DIq3T1vDMG7caeRG+
Kgfb3odpFQMz/khwzZLBDwK22HCh4g3LGM38rUhRzz9+70MfbjWKiofwbdzFE51s8FE6n
p14kN1TQ9fDfrOqFqBLvxenCi6Cmv0yMepjwgWOcISKKrMGEieKapvEPOXWorcVZTP//8
xe/Rd7TAUY2hfJbNpzRP0xtongpsEeujaUob/8obfLSmqCeSE1skFbA7Sgbzj/7utxHrH
8CxKUllNou9YTs7UNTWt2cyHdbOvr9Cc9M2UbabMe3A0K+77L2a2sDoLo0th8j94wlQ==
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=c1o2ZLKr;
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 2D2FE606A32C;
Thu, 26 Nov 2026 21:33:48 +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=c1o2ZLKr
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.218.45
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795728827;
b=s+L3gaxi7SL4aRZ6IOCE6e+Ii/zX5H1RNv12807+Mit9/1XNlvLB98NsMo0WomSnkxgt
igBBAM+9f6rw4leWVdTCtslJRqIbXzX7AOZEX3D/aaxiuCHbNmSV+lEWCCN43WzmGqThS
8Xj8SMp5XXk97RZhxHOHG6T8gZ/bOSlfLAM378rV3OIWz6zpT7eURQvcIlwAzMmygQiZN
7lNDxUEqk4n88s+a7KkLsbbRdrrOuTwyttBRLK3KDdsVJJfLtJluDa9tvpq/2ZeC2Jrfy
30tWeVAiCHex9UZsQsoAInMqHEBTfd/ZYHidpHQ/NVUhlAQKe0BWK+8jw3Lc++lyoUg==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795728827;
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=kNCp9ooakQLTw1XGQmLL9/FFbmGrgEQcXHdOSEyb2E9vC9RewWWfLEB4rdIAoFsdwjqI
xrApgw3n2pHZ4NWh7OXQ2MlS9jl4xcXAB0zTCCUofAI7fQ1Pf4yI4IRHaPWEa7trvRrF+
q2FZ7Ek4MBnSMGIGpHEKJ111YibFqiNDd1ikRxNnnUbeNA+TIgyvOnXnEprhzUmZwzTO0
e0K3IBQOknvyYnK+xcyIJgCaY/sIHTAhEqf0FIln1rEPW9jvXTtLn16d+peYfQ8VEztNo
I3HsFwNoZepXLKLKQ3UBOAbGj7VTjDbOsDO4DNBwzML1gLsJ3+vtEpoT9w1Xo5XCYFQ==
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=c1o2ZLKr;
arc=none smtp.remote-ip=209.85.218.45
X-Received: from mail-ej1-f45.google.com (mail-ej1-f45.google.com [209.85.218.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 EF240606A31C
for <git@vger.kernel.org>; Thu, 26 Nov 2026 21:33:46 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EF240606A31C
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-f45.google.com with SMTP id a640c23a62f3a-c4cb6834eaaso346397866b.2
for <git@vger.kernel.org>; Thu, 26 Nov 2026 13:33:46 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1795728825; x=1796333625; 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=c1o2ZLKr2Cel1msl/nVV0xlQSaUryGRRcTjAx09xcITN5b7S6wdmpNdPBq0aIFg6n9
Vy1dymUEhVODK5Ka85Tg4AkLUiCXt6XNUbTMKT/CZ8Bw99tG+XU78nbH8Whd93DipbTd
JrYIWuKYAROfgJA3tmZ0zxhb+GAwBWERYpp3vZnY+b9NtmovugBhqgOODjA621ZlbwH2
DBdefCMRCe2/6ruPOrRGw2RmpREGQMi8n8xebv3AVnPuHFRhlYQkc8fpwtDXdAjoPJ5s
Av6A/Rcf6QSKKBtsdIe/z20cVx9Cg9B0YGuVbDJaENsiLbSPWab79+AjM4+HY/iGnQ3X
QO7Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795728825; x=1796333625;
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=Rf90lnkLjbdBmbdEFnFL8/RKfWNQ2QTnFxeKPMi5VY33iAaXU22d5KmRnOmDqiw+tL
11TNlLAIxGbYoJTVjOuiTrFeF+AT/yyfmYJAjBrArZrMAzj9Lj80B/x4bIexR/27tiLH
6Atr9j/5RUbWAuAI9ZrEY+U5/J4YgVUg4ckKm2mI/hELp0TJSj+A3ygw/RDQdeVTgcEw
P6egFT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c6e1:3cf4 with SMTP id a640c23a62f3a-c51c6e14021mr257181666b.6.1795728825268;
Thu, 26 Nov 2026 13:33:45 -0800 (PST)
X-Received: from localhost.localdomain ([104.28.251.99])
by smtp.gmail.com with ESMTPSA id a640c23a62f3a-c513b030ed9sm805237066b.86.2026.11.26.13.33.41
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Thu, 26 Nov 2026 13:33:44 -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: <20261126213306.87466-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