Article View: linux.kernel.git
Article #3715[PATCH v2 0/5] notes: start passing the repository through notes.[ch]
From: Okhuomon Ajayi
Date: Tue, 24 Nov 2026 17:21
Date: Tue, 24 Nov 2026 17:21
107 lines
15320 bytes
15320 bytes
This is a preparatory series. It makes the code in notes.[c,h] and its
direct callers work on the repository stored in struct notes_tree instead
of the_repository. It deliberately does not convert the whole notes
subsystem yet; it does the bulk of the work in notes.[c,h] and leaves the
rest for future series.
What it does:
- stores the repository in struct notes_tree;
- uses the tree's repository when reading, writing and pruning notes;
- passes the repository to the ref glob helpers and the combine_notes
callbacks.
What is left for future series:
- notes.c: the display-notes code keeps its state in globals, and log,
format-patch, diff-tree and format-rev are given a repository but do
not pass it on. format_note() still falls back to the global
default_notes_tree, and expand_loose_notes_ref() only takes a strbuf.
The hash-size helpers are also still on the global.
- notes-utils.[c,h]: still use the_repository. And the hash-size helpers
still on the global are reached from here, through create_notes_commit()
-> write_notes_tree(), so converting notes-utils is tied to converting
those helpers too.
- notes-merge.[c,h]: still work on the global repository.
Changes since v1:
- Dropped the final patch (notes-utils: use the given repository) so the
series stays within notes.[c,h] and its callers, and reframed it as a
preparatory series.
- Moved the copy_note() change out of the combine_notes patch into the
writing-and-pruning patch, where it belongs, and updated both commit
messages.
Okhuomon Ajayi (5):
notes: store the repository in struct notes_tree
notes: use the tree's repository when reading notes
notes: use the tree's repository when writing and pruning
notes: pass the repository to the ref glob helpers
notes: pass the repository to the combine_notes callbacks
builtin/notes.c | 8 ++-
notes-cache.c | 3 +-
notes-utils.c | 9 ++-
notes.c | 164 ++++++++++++++++++++++++++++--------------------
notes.h | 40 +++++++-----
5 files changed, 134 insertions(+), 90 deletions(-)
Range-diff against v1:
1: 79ca75340a = 1: 5ad0f1bd62 notes: store the repository in struct notes_tree
2: 9692b4f18c = 2: 1018419720 notes: use the tree's repository when reading notes
3: f87b683aeb ! 3: 67a2942c09 notes: use the tree's repository when writing and pruning
@@ Commit message
the repository, passed down from the tree. prune_notes() hands
the repository to its callback in a small struct.
+ copy_note() also writes through the tree, by calling add_note(),
+ so it uses the tree's hash algorithm for its null object ID.
+
Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
## notes.c ##
@@ notes.c: int write_notes_tree(struct notes_tree *t, struct object_id *result)
}
}
+@@ notes.c: int copy_note(struct notes_tree *t,
+ if (note)
+ return add_note(t, to_obj, note, combine_notes);
+ else if (existing_note)
+- return add_note(t, to_obj, null_oid(the_hash_algo), combine_notes);
++ return add_note(t, to_obj, null_oid(t->repo->hash_algo),
++ combine_notes);
+
+ return 0;
+ }
4: 469aa752ab = 4: 7ea6c0e5a2 notes: pass the repository to the ref glob helpers
5: 517c056f8d ! 5: ff8cf4d22a notes: pass the repository to the combine_notes callbacks
@@ Commit message
belongs to another repository. The callbacks are only called from
note_tree_insert(), which has the tree.
- Pass the tree's repository to all combine_notes callbacks. Also make
- copy_note() use the tree's hash algorithm for its null object ID.
+ Pass the tree's repository to all combine_notes callbacks.
Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
@@ notes.c: int combine_notes_cat_sort_uniq(struct object_id *cur_oid,
buf.len, OBJ_BLOB, cur_oid);
out:
-@@ notes.c: int copy_note(struct notes_tree *t,
- if (note)
- return add_note(t, to_obj, note, combine_notes);
- else if (existing_note)
-- return add_note(t, to_obj, null_oid(the_hash_algo), combine_notes);
-+ return add_note(t, to_obj, null_oid(t->repo->hash_algo),
-+ combine_notes);
-
- return 0;
- }
## notes.h ##
@@ notes.h: struct strbuf;
6: 75b58d578b < -: ---------- notes-utils: use the given repository
--
2.56.0
Technical Details
Message-ID:
<20261124172146.18330-1-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-76233-linux-kernel-git=dewy.ruReferences:
<20261105203344.48513-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-76233-linux-kernel-git=dewy.ru
From: okhuomonajayi54@gmail.com (Okhuomon Ajayi)
Newsgroups: linux.kernel.git
Subject: [PATCH v2 0/5] notes: start passing the repository through notes.[ch]
Date: Tue, 24 Nov 2026 18:21:41 +0100
Organization: Usenet Network
Message-ID: <20261124172146.18330-1-okhuomonajayi54@gmail.com>
References: <20261105203344.48513-1-okhuomonajayi54@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="4189222"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:L4Ucl4xvThXHQKWpAsowDQzuWGM= sha256:gRO8x1j1Rv+Rv2Vu3hG5oElfNByuk55lImu/Ajdb1k4=
sha1:mLE28ZBrnXcYlVlgqrzzd+09vqY= sha256:HfB92AWEGH11yAS6jvpOw5RUqOGY/WZRy3SAjQGlMhg=
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 1602E125E29; Tue, 24 Nov 2026 20:23:07 +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 8IunDgpd19TL;
Tue, 24 Nov 2026 20:23:03 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76233-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 14AF5125E2B; Tue, 24 Nov 2026 20:22:54 +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 3CD783A590; Tue, 24 Nov 2026 17:22:53 +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=1795540973;
b=l7chJsOoCh3AY3QAHFLgNvrFbk1gqBuXzPIkxWlI0/AKHumqeUvFR8zOLZTqyOpMy2we
yVCZviYFT4X/bW63dMOcmqyV7rhZSiBwdeQLwniWi5ks/tn2Vj869XilOxn0aVtRnMksB
blOXaiusVcwCbnkWDJJkcvxPq4uGPO6xW/Inp94AkYjk228y5XGdc9fEH8y3+HDkJ3b+z
nHeYuxwbQxZrirhhoTYBJlq+Qvq17cmYTavJ9I/jHba2B+Tq7sqHsU9CyxpVC0Kerd7UV
KkemWFQ7vxmEv4vG2OXlaeMY77uH+gSSeZxZK2qGo56p/yfNl/mHvTaAOG5OvBbTeHw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795540973;
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=kezZGHeLloHaJ2MKhoiAIbrQQR8LDYCZTYZeN0WxIEU=;
b=ORDrxKkAyDHYgICROs/Sqspyaj7p55Uzl1W9DuEKkhH09PN/+mHcgPQMg+dzxv0p7YRa
GHsXaYLacE5l83q6oXA2RbYygDmRLNSA745s307jNbSPC4ANHh0qLuBkFaE4jLY2fRHni
427tPU0iTlUb6ITisuCIAHl7p3L8+KDsjotLsHZj4dvHDSe3w672kPPQfaC58q8UVNrVJ
nugXEZd62ughW9n8R67BUSgBUHZsxNzGon/6SqCkltNd00HvKYRBUJYVCdu6Q06u1/0Wo
GqDo6qnruDLtB5qbcMeZjpfO9KTzt4e3UFmVRk+r3WCyr1MJSzLiOC1O9drmBabnq2w==
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=CzRgw4xw;
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 11EFB606A326;
Tue, 24 Nov 2026 17:22:53 +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=CzRgw4xw
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.208.50
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1795540972;
b=WkDMfwXHHknSYcrh1Af8Kn/uKCPwzsaDO9XGsofsWVzZhNVRrhq71Y+qgvr+HfP/UUkn
BhcQLbwnq8AvZLzAoCE+rCSsBThhlruMVELbGzOrEs886X/nJ50KLAa6hfzGNfP2h8QTR
XMzyGKHDw3L7mY8ppRkItoRLVt1lpwPO0pKv8uc7obpUtTPUpPg93wrqZueoIJFADKh+8
qAuyReeR5H6hQTD1nM3ZszclC35sYIe0N1iI7lYrT7Bv95FdXujCNEL7+2Qu9qGPctL1J
oZMhmp6Qelf8GHKzmj6B9L8KK0qFPzUjkpzvzNGwHVJBk7y3eXxJWRNTyXbGxOa7O1Q==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1795540972;
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=kezZGHeLloHaJ2MKhoiAIbrQQR8LDYCZTYZeN0WxIEU=;
b=puVjx4R5xjmcja2fHlSv2uaAbl62FIBLs5DIrcgiYdpoctKsY+SWuoyzyhHIgo6j5m89
ODZ3cmdZK6v4nHDq98b7iesuQV09j2zg2kyMO66ETs1vlEw471GuX38au0j480Hw7Kshl
n6JDjgS70QJxTxPPrQQ7NP+55rEkfsMM7Y0HrMVwU2jJB5B7wuBJSV7R+au8+XuZi7CQB
j4V+b657NZeNFlQdrQofD5XEJg379e5goSjEOFkxGCjDK7y1gOZzExqhdM+B3tLJ3ksFX
wEbQfjNy3tyfzaZA5qvkmOYMsE8jGrDMuxM2vUQJX6yqeV3YtaYnLchJ9Xo9XDyTS1g==
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=CzRgw4xw;
arc=none smtp.remote-ip=209.85.208.50
X-Received: from mail-ed1-f50.google.com (mail-ed1-f50.google.com [209.85.208.50])
(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 CC742606A31E
for <git@vger.kernel.org>; Tue, 24 Nov 2026 17:22:51 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CC742606A31E
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-ed1-f50.google.com with SMTP id 4fb4d7f45d1cf-6ba380cd8dbso6421372a12.3
for <git@vger.kernel.org>; Tue, 24 Nov 2026 09:22:51 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1795540970; x=1796145770; 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=kezZGHeLloHaJ2MKhoiAIbrQQR8LDYCZTYZeN0WxIEU=;
b=CzRgw4xwiEAhTLIYId9wJWcX4IB+V9+EBK8z7CcKIts+oPS4MTtJ98HFQ1ggK3FDL1
B5dhRFZAzj+YquCpcdYLxZzpQoGnqpoZlUQ1/EgzXp9hejr2i88AduePFvTcU3MTweet
4rT19kfPFaebQuUOGyKMlcV5UcCKFyzkBhj+X07othKSPM55o5VmqlhoBGF5zgGOZqhU
4AAr01Tmx0bnpqgoFJWxSUEyXJNASwnLsIQUYKqZq0VyccCz1hBZheWVJQnUdM112wTj
w1YKfwx+bAiGfqhrjoYzMgPotliW2PoNIzQTJqB91Aey3WfAcAYeyrrUMKXcp5mZmlSk
uYMQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1795540970; x=1796145770;
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=kezZGHeLloHaJ2MKhoiAIbrQQR8LDYCZTYZeN0WxIEU=;
b=Xduuc1SWXMrwGK3IdaKT3SVHLMVFSQHVPzu4dBO1z3vDDk9d6Zk81dwGS6Ov1YNetT
izNVr89XLlw3ZDvmjqm98UelB0AToXmHVM3ZF+ZRLSgjqEDYv4ekgRMew1GJwuLuY8CT
66F8w5aUAKKAfZeuwjrFAkLRE6Sn0My9QnZySsIZOuVhuIRFNHt3lcooDZx4lP5dBAIX
D/FbZ0P0R95wc7Gl8QJvXAUi15kXlWvpqJ1KHaz740u1N5EEe0Disue9zGYNzTYTul5U
71jSszHamI78K0zv1ojMmNnJxjtyGg2S5lkYphBrvlNcKfV4PqOXXntucicGtYZ9yxgZ
ta6A==
X-Gm-Message-State: APuU4Z9EkO1Ii0QXE3hLnmo6bl9N2HLCZkskjxoTGdC7h5Aq0gVtZOUO
4WAZ1etBdDQoF3n91MlJrH8tu2WOJeEvLRpqWywn2HkocuBwYj6MP1Yl8+Or0W5D4Gw=
X-Gm-Gg: AZFdTZdPn3SAV/ddJuYhoXoqQ+arQzV7cCfkeA7rlIXNmWRjC1E55MdKPyVj+FggSeO
rhgN7gHlGwfmNIWYS7RMuoLHgtEwD1daIwP7/OX7t8eAwNcMLKBNy/DAJAN5/qf/D8DLu97uqfM
WCBliwz1vfr7Kw2xeZMwr89jT1O8t2SiOMB+8TfVkTuf5IgCRlYsOwZp2GL58vMoNbh57fCEXnK
ygHM8x11dRTXmSNx0j5EP401FCxyK8mkXXEpZ93CG1LOOoAh6jKtKDcItF3i/cSdNJkjGJQWw5G
m1RiiO2LWqU+LaVeHWKiLid6Cb5/oPTc2EI8l4RxaIGnZEVyRF9x39PK23xwMhJl+ZcILJSnIIi
RakmkpmZJHhy1adwXxHg1oauEkD2/o2JVXTcAnpgC96ks2lh2EgYI3w+U14vWzxZeh3bHVXB6DW
AK4w0fFSHeKbauu0Ja0CO347y+J43wfZ9YtBXyelYDb7e/EG1hWjEJbPxs5nZ6MMBgRmB5OOl/m
ayb5yrA8zUQiR0IKk4CBom+Dt8WHSm/2NpBxXo7TOO2NtT7MM1sMHTGV+SNuENl8sE6pIbn+kiG
vVT0SsEpTvqP4vKIvaduRURH74f6ljib8wBq14sMqKBjksJwxRfWaR1UoB+f7XCRZCLgR2tc4Ae
TxBBGxlUu57US58EoGD8ixR2yz1ghU30CteuzwVBC/XPhpObYfgXoWByLHOKnXdSjbBMfS0GlMq
boow8+PPiE4xAnlrRC7pMR4jeyXBtx
X-Received: by 2002:a17:907:9584:b0:c34:e9fe:82ed with SMTP id a640c23a62f3a-c513a88223amr1197255966b.28.1795540969887;
Tue, 24 Nov 2026 09:22:49 -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.22.47
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Tue, 24 Nov 2026 09:22:49 -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: <20261105203344.48513-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