Article View: linux.kernel.git
Article #1817[Outreachy PATCH v2] bundle-uri: stop using the_repository
From: Okhuomon Ajayi
Date: Thu, 29 Oct 2026 13:13
Date: Thu, 29 Oct 2026 13:13
124 lines
15060 bytes
15060 bytes
unbundle_from_file() receives r and unbundles the objects into
it, but reads and writes the refs in the_repository.
fetch_bundle_uri() also has r, but uses the_repository for its
trace2 region. find_temp_filename() and copy_uri_to_file() also
use the_repository, even though their only caller,
fetch_bundle_uri_internal(), has r.
Use r in all of these places, passing it to find_temp_filename()
and copy_uri_to_file(). With that, bundle-uri.c no longer uses
the_repository, so drop USE_THE_REPOSITORY_VARIABLE.
Signed-off-by: Okhuomon Ajayi <okhuomonajayi54@gmail.com>
---
Changes since v1:
- Also pass the repository to find_temp_filename() and
copy_uri_to_file(), and drop USE_THE_REPOSITORY_VARIABLE,
as suggested by Patrick.
Thanks, Patrick, for the suggestion and the diff, and Karthik
for the review.
unbundle_from_file() still depends on the_repository through
fetch_pack_fsck_objects(), which reads fetch.fsckObjects and
transfer.fsckObjects from the_repository's config.
bundle-uri.c | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/bundle-uri.c b/bundle-uri.c
index 2bb2eb99e4..9797eaed9a 100644
--- a/bundle-uri.c
+++ b/bundle-uri.c
@@ -1,4 +1,3 @@
-#define USE_THE_REPOSITORY_VARIABLE
#define DISABLE_SIGN_COMPARE_WARNINGS
#include "git-compat-util.h"
@@ -286,7 +285,7 @@ int bundle_uri_parse_config_format(const char *uri,
return result;
}
-static char *find_temp_filename(void)
+static char *find_temp_filename(struct repository *r)
{
int fd;
struct strbuf name = STRBUF_INIT;
@@ -294,7 +293,7 @@ static char *find_temp_filename(void)
* Find a temporary filename that is available. This is briefly
* racy, but unlikely to collide.
*/
- fd = odb_mkstemp(the_repository->objects, &name,
+ fd = odb_mkstemp(r->objects, &name,
"bundles/tmp_uri_XXXXXX");
if (fd < 0) {
warning(_("failed to create temporary file"));
@@ -384,7 +383,8 @@ static int download_https_uri_to_file(const char *file, const char *uri)
return result;
}
-static int copy_uri_to_file(const char *filename, const char *uri)
+static int copy_uri_to_file(struct repository *r,
+ const char *filename, const char *uri)
{
const char *out;
@@ -396,7 +396,7 @@ static int copy_uri_to_file(const char *filename, const char *uri)
uri = out;
/* Copy as a file */
- return copy_file(the_repository, filename, uri, 0);
+ return copy_file(r, filename, uri, 0);
}
static int unbundle_from_file(struct repository *r, const char *file)
@@ -448,9 +448,9 @@ static int unbundle_from_file(struct repository *r, const char *file)
strbuf_setlen(&bundle_ref, bundle_prefix_len);
strbuf_addstr(&bundle_ref, branch_name);
- has_old = !refs_read_ref(get_main_ref_store(the_repository),
+ has_old = !refs_read_ref(get_main_ref_store(r),
bundle_ref.buf, &old_oid);
- refs_update_ref(get_main_ref_store(the_repository),
+ refs_update_ref(get_main_ref_store(r),
"fetched bundle", bundle_ref.buf, oid,
has_old ? &old_oid : NULL,
0, UPDATE_REFS_MSG_ON_ERR);
@@ -774,12 +774,12 @@ static int fetch_bundle_uri_internal(struct repository *r,
}
if (!bundle->file &&
- !(bundle->file = find_temp_filename())) {
+ !(bundle->file = find_temp_filename(r))) {
result = -1;
goto cleanup;
}
- if ((result = copy_uri_to_file(bundle->file, bundle->uri))) {
+ if ((result = copy_uri_to_file(r, bundle->file, bundle->uri))) {
warning(_("failed to download bundle from URI '%s'"), bundle->uri);
goto cleanup;
}
@@ -859,7 +859,7 @@ int fetch_bundle_uri(struct repository *r, const char *uri,
.id = xstrdup(""),
};
- trace2_region_enter("fetch", "fetch-bundle-uri", the_repository);
+ trace2_region_enter("fetch", "fetch-bundle-uri", r);
init_bundle_list(&list);
@@ -886,7 +886,7 @@ int fetch_bundle_uri(struct repository *r, const char *uri,
for_all_bundles_in_list(&list, unlink_bundle, NULL);
clear_bundle_list(&list);
clear_remote_bundle_info(&bundle, NULL);
- trace2_region_leave("fetch", "fetch-bundle-uri", the_repository);
+ trace2_region_leave("fetch", "fetch-bundle-uri", r);
return result;
}
base-commit: 37b3475fb530c14109211faca33716a173db61ed
--
2.56.0
Technical Details
Message-ID:
<20261029131325.79176-1-okhuomonajayi54@gmail.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73769-linux-kernel-git=dewy.ruReferences:
<auM3DGcWTL5OdRnD@pks.im>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-73769-linux-kernel-git=dewy.ru
From: okhuomonajayi54@gmail.com (Okhuomon Ajayi)
Newsgroups: linux.kernel.git
Subject: [Outreachy PATCH v2] bundle-uri: stop using the_repository
Date: Thu, 29 Oct 2026 14:13:25 +0100
Organization: Usenet Network
Message-ID: <20261029131325.79176-1-okhuomonajayi54@gmail.com>
References: <auM3DGcWTL5OdRnD@pks.im>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="2013059"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:7NbLbMI8TUTNSwtaJprpAxb11LA= sha256:NAUT7VT9n3l1+fsADhDo2YqoJmlYIZI5vej5eqyNSc8=
sha1:C6esZD85PoMApHK5HRhYRvBN+rU= sha256:hUJYLFTtHxtib/mtfct2aCX1kbsG13kIxU2nP6HVGc0=
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 8E887125C68; Thu, 29 Oct 2026 16:15:52 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -3.048
X-Spam-Status: No, score=-3.048 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.25,
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 FRxWkZp0P29O;
Thu, 29 Oct 2026 16:15:50 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=git+bounces-73769-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 DD801125C65; Thu, 29 Oct 2026 16:15:41 +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 0376D28F7D; Thu, 29 Oct 2026 13:13:45 +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=1793279624;
b=hvbpS61uyihHmYZ3b3/5QcY3JRoquz5o4EMWfHvTqdnohlHnu5fXiDqhlc5YqkqMQ5DQ
Or//rApV+SbGVKH8vMSpPzVzW2pzWd2TaYQIOWvI+5qMaUYdqZEbQtmtujWPFhA8yaFPx
Cw+1jcByiNXko3mtw1ZzKHEuPELaFEuROcg7I2Iqkg1RR6FgARK4H7mt4tkedDxNk+8vH
iJ0OYGZkDM4v+GaPnyTRFCZasIE0OWsi3JlMBqj7WH99wcmc9+UkYiAZdeKGphlMbHYVZ
KIg/2F/He1GQ7SNpHEbjVWREr077pGArxKMosTtKL8mVec7SROggVF7MXZRWZK3UauQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793279624;
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=5ccRXohapoGrF44EK+Pjbx78IG/gDpGV6aZsG7rx2Jw=;
b=kKRjLtYbVmJT2nUcSLx5jR+XO1MPD9vBJurTWGRFb7XERb6c0gq12u24YcXlCVgGbFgc
oGiYhrx/HcqJLwMXjZ+4oOYMf1U8eydwomOTjCODrBufDJJcc+Fsv265hmSLSls8P6zvj
d81iGXCg0Bd0dKOLnXi72l8ElbN42kl+vnGJ65VLJB83DQZoyzTsUdBOocpG+5h9Aa6vP
hjH+CKhlKswtWh3YoWQF7YgYyFVM/cSokaH84gCT4zF/C9eyF7SyF6yCefU5IAwQa5gDS
zMKY2U805z5798k+ilhF2tbtZhiuvX92eUYqhOV8zATZj0cp6Z20jgZNpJ/8sPY7myg==
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=CwQ4wbPz;
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 756D9606A322;
Thu, 29 Oct 2026 13:13:44 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=CwQ4wbPz
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.128.43
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1793279623;
b=LOIx+SysJdNXeFISB8FbWl4OVXCgU3MZPNW9KjdurwooghxYBhHtHjwnxL/ZB8NacEqJ
4oKR37MMSYy3JpXIQy0GVhY7U00gRa5m5WzlU8+X4aQrSE1RiqoQrfppfCNSUnRvTw8th
QBhtl1d16ePCYwLmuIN5gy/RJjYblW3SjcCF20ZjIY/d4eYYgtQXo4y+rV1TNTkqPpaWW
mXXDqSSxu2/Sq3cJPZwPny4b70xo6YtqMZX1ANkIFd9HLd/bhf+Q182IMku7SpiqAJ5GS
XL4z4HJchwJxQeiAt6YgFZjA4gs8X+MwbXnpQt0BRkfiSwEmzc33CTksOuiEuvc+tdQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1793279623;
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=5ccRXohapoGrF44EK+Pjbx78IG/gDpGV6aZsG7rx2Jw=;
b=lc7lIkZvH4npBM2cC2TvEpvCil7SJNZE8mOqBJo8fA+iCih5A9En8UhgRPBhopiHBMA8
bYicoECd+AY4GboySEI+R6cY0y5Meai6B8imCQ4Q8TZX6bV2+2RHhi4RZFKsSw3e6gP7/
0CKFTFdX3u9wUPJ+SyQ4x2fdxcHvxU2hSsKi2HZycz6fInhmJZXLqz6NVPPllPTrtOVPj
OMZ9Yd28dbaH8HKIZYbzczgDFfVHbXGH6LNhPXoe+CyGL4obZumzKIt/rpITzj2ZW/XRB
If2tpSuQx8zDzqI6zQVS0ItmSGG35cN2iKGsHPbZnksPyLwDWqqYrehHWTUrq07WG3g==
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=CwQ4wbPz;
arc=none smtp.remote-ip=209.85.128.43
X-Received: from mail-wm1-f43.google.com (mail-wm1-f43.google.com [209.85.128.43])
(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 3A54D606A31A
for <git@vger.kernel.org>; Thu, 29 Oct 2026 13:13:43 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3A54D606A31A
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-wm1-f43.google.com with SMTP id 5b1f17b1804b1-4a2153c8525so15822735e9.3
for <git@vger.kernel.org>; Thu, 29 Oct 2026 06:13:43 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1793279621; x=1793884421; 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=5ccRXohapoGrF44EK+Pjbx78IG/gDpGV6aZsG7rx2Jw=;
b=CwQ4wbPz108mJxF1bx5xS4xw0feafKC9PJ08FicyF/hrKR5mmKw5zZNSKPfMp30Vjt
i74hxyjNt5Nuu/qOWhbEyHb53LovEMVdFTH7CTdjZAdfl5uKlyX1t8LlF7+48d5swVhB
MNK3/vMnBJdHzk+yG/wV//UEkMM+yq+ogXkoYFQ7oAS/qM26w3AEW2uJrLNfvJZZt0QZ
sH22Pmi01R30kF6C17KdTK01MA1DJKS+GsBzzl3+5XPt5hpFGICXDI6v3s68m4v6ZVhl
3TQNVY1U78xuw0TzFSC+HJoyTijCr0RaSAPYmO1gWAE5hcHNBkn4AaxelcuS/0HCpokS
cOVg==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1793279621; x=1793884421;
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=5ccRXohapoGrF44EK+Pjbx78IG/gDpGV6aZsG7rx2Jw=;
b=Xwhp8pxgGoGEIbyRYXP5501tnA7cpkqnt5FiAS+WXNlW8jj7lBsGYZ9BwRnIx48fVQ
8iFgVsejomnYKQS3e/yQcMiaHr3/nm5dAoT1f5GzmAUfby1RSjqzk6XGmB4GGIpjci5u
sPpLPWaB5WwSjNeWN8+YNPSRPzaJq+4smsr2FA4PUiJbohpUIYsdrbAaqD0ttjFthZc4
OsNor8AAopy8d1JO17RSok4XFSFfDvMsSf7m4Aos3JBsOsKVcBPuq4lbXkRihDY8HAw/
pIF/PCsoyCOMFESPDj86JWfXJ1wdWSPrFtT0r+55N/FoDyXx3YT2UgE7waPPKATiewLX
hsWg==
X-Gm-Message-State: AFq9FYLkUZAx4VpgKYX+JWAfGc8haWEv9qKEDOZ0yT/2CGxpXUjgO6JR
ueH4BQYagoL8O4jujnEKmKD1Z87WTRa+Q9vmYgZfe5BsPpUqssyhLwh3ULZ1bUDn37g=
X-Gm-Gg: AYBFou1eTwMchS8f/1GMcRLEnOGmvGG9kCamTfmGvVxPHchgMxBMf3AtvWWOVCAM5j7
1ust38tzXnx5CRdcYyBbPIX7I6qIdCxKFrAng4ELconf/UJ2I2BEWhTicTff56J5U/EoJO6/90o
WkTm8QoPNnQm6kbcEIIr2yiUPmP9FxN9k6+WWeQXtEZkXQKSvFTOxZRuCYrxxxv7spgT/JiWi50
iRLURqBmkgL3ZMFGmbER3zxATZ20vCzEIlYOdAE2xlUbi9m686sb34nDRsEHmv+3HnUBRu5DvE4
22mcljCxLht3Gr2NKM6Sq+G8806+I8ycD01WCa9I/t6EJzgyECpmPoQELJDvrBKlLphwadQeYct
Uc8v+bB77aA4PjHjIquzz2+uK5rR3HF0ZOWOTObFvfWBZQL2QELnoRWsh1BU+bTXrJF4dEE6Yu3
C/ygdoG20F+s/PXpB3i43XI8butQC3fDO49Vg5y3YWGx4iLhTH334rnD1WW5EPTAo8FlbF0nX3W
y7QuxokbKo+ETllsmSKc6wUsUZNFsVIbalQNvj56FlOwFXDxeNqwTrTYtIN9euG3XZdGBN2d3TB
3pj/CSvxQNKeKPrNx3rbEMLqjLvyZCxitJEjXXtKk+qCcWwlKJBQHPJ9izNXlFjld/vIrOB6dWr
Y1cIAKSNf4TTUxsUjCMYorAwdrjvnz0X/aq+bSG657WkLugv0Ytwmjj9ldDhTSs0RjWTnu42uq4
rV4PV1uhj/PsGPLBVI1oFISAv2nzZ1GT1GxE4FaJxB6yWHfQ==
X-Received: by 2002:a05:600c:3510:b0:4a9:18f4:925e with SMTP id 5b1f17b1804b1-4a966774dc4mr124478275e9.18.1793279621363;
Thu, 29 Oct 2026 06:13:41 -0700 (PDT)
X-Received: from localhost.localdomain ([105.113.99.55])
by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4aa80f04723sm72386865e9.5.2026.10.29.06.13.37
(version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256);
Thu, 29 Oct 2026 06:13:40 -0700 (PDT)
X-Cc: christian.couder@gmail.com,
usmanakinyemi202@gmail.com,
siddharthasthana31@gmail.com,
kaartic.sivaraam@gmail.com,
ps@pks.im,
karthik.188@gmail.com,
Okhuomon Ajayi <okhuomonajayi54@gmail.com>
X-Mailer: git-send-email 2.56.0
X-In-Reply-To: <auM3DGcWTL5OdRnD@pks.im>
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