Article View: linux.kernel.git
Article #1239[PATCH v2 03/13] loose: add a flag to control whether we write mapped OIDs
From: Christian Couder
Date: Fri, 23 Oct 2026 07:25
Date: Fri, 23 Oct 2026 07:25
90 lines
13927 bytes
13927 bytes
From: "brian m. carlson" <sandals@crustytoothpaste.net>
Right now, we always write the object to the loose object map. However,
in the future, we'll need to temporarily store some object ID mappings
in memory so that we can rewrite other objects, such as when we're
indexing packs. Let's make this easier by setting a flag indicating
whether we want to write this to disk.
The bottom six bits will be used for an object type in a future commit,
so pick 1 << 6 as the write bit to avoid conflicts.
Signed-off-by: brian m. carlson <sandals@crustytoothpaste.net>
Signed-off-by: Christian Couder <christian.couder@gmail.com>
---
loose.c | 5 +++--
loose.h | 6 +++++-
odb/source-loose.c | 4 ++--
3 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/loose.c b/loose.c
index 8d7ea27448..090681b4b3 100644
--- a/loose.c
+++ b/loose.c
@@ -212,7 +212,8 @@ static int write_one_object(struct odb_source_loose *loose,
int source_add_loose_object_map(struct odb_source_loose *loose,
const struct object_id *oid,
- const struct object_id *compat_oid)
+ const struct object_id *compat_oid,
+ int flags)
{
int inserted = 0;
@@ -220,7 +221,7 @@ int source_add_loose_object_map(struct odb_source_loose *loose,
return 0;
inserted = insert_loose_map(loose, oid, compat_oid);
- if (inserted)
+ if (inserted && (flags & OBJ_MAP_WRITE))
return write_one_object(loose, oid, compat_oid);
return 0;
}
diff --git a/loose.h b/loose.h
index 6f0c8554ca..19d3be26a3 100644
--- a/loose.h
+++ b/loose.h
@@ -3,6 +3,9 @@
#include "khash.h"
+/* Should we write this object to disk? */
+#define OBJ_MAP_WRITE (1 << 6)
+
struct repository;
struct odb_source_loose;
@@ -27,6 +30,7 @@ int source_loose_object_map_oid(struct odb_source_loose *loose,
struct object_id *dest);
int source_add_loose_object_map(struct odb_source_loose *loose,
const struct object_id *oid,
- const struct object_id *compat_oid);
+ const struct object_id *compat_oid,
+ int flags);
#endif
diff --git a/odb/source-loose.c b/odb/source-loose.c
index 3c0c85f3e3..b58184f31d 100644
--- a/odb/source-loose.c
+++ b/odb/source-loose.c
@@ -848,7 +848,7 @@ static int odb_source_loose_write_object(struct odb_source *source,
return -1;
if (compat_oid)
- return source_add_loose_object_map(loose, oid, compat_oid);
+ return source_add_loose_object_map(loose, oid, compat_oid, OBJ_MAP_WRITE);
return 0;
}
@@ -970,7 +970,7 @@ static int odb_source_loose_write_object_stream(struct odb_source *source,
err = finalize_object_file_flags(loose->base.odb->repo, tmp_file.buf, filename.buf,
FOF_SKIP_COLLISION_CHECK);
if (!err && compat)
- err = source_add_loose_object_map(loose, oid, &compat_oid);
+ err = source_add_loose_object_map(loose, oid, &compat_oid, OBJ_MAP_WRITE);
cleanup:
strbuf_release(&tmp_file);
strbuf_release(&filename);
--
2.56.0.215.g47fdf2208c
Technical Details
Message-ID:
<20261023072559.3204273-4-christian.couder@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-72949-linux-kernel-git=dewy.ruReferences:
<20261023072559.3204273-1-christian.couder@gmail.com>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-72949-linux-kernel-git=dewy.ru
From: christian.couder@gmail.com (Christian Couder)
Newsgroups: linux.kernel.git
Subject: [PATCH v2 03/13] loose: add a flag to control whether we write mapped OIDs
Date: Fri, 23 Oct 2026 09:25:48 +0200
Organization: Usenet Network
Message-ID: <20261023072559.3204273-4-christian.couder@gmail.com>
References: <20261023072559.3204273-1-christian.couder@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
logging-data="438237"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:v1WLW9O1aGjKqg+NcMLABMm6WI4= sha256:rp1vywk8O6Au95TK3K+2VObEjn6DG/kcRbMsTx5hV2s=
sha1:XIPRl5rkLMDrfPpp2XsgEuZp5rw= sha256:fJvdX7uPHpio+yf8GsqYCUCSxOIoFrSTGDORUsttEC0=
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 BBA9011141F; Fri, 23 Oct 2026 10:31:32 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -0.948
X-Spam-Status: No, score=-0.948 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, FORGED_GMAIL_RCVD=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 fZLfRHwc2Y-r;
Fri, 23 Oct 2026 10:31:30 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-72949-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 A112811141C; Fri, 23 Oct 2026 10:31:21 +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 B6E2932A60; Fri, 23 Oct 2026 07:26:27 +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=1792740382;
b=bnEnWN1EW3B72zmoxJRBVwQ6whSnBstj5Tz+wtXolE0N2XQ5wHWrHdIVeXbRejdmJZ4U
FH1iSCCurVN002x3ceZp3GF5HttRp6ozH037IU03E2H7y3WqJRx1mCVH4ihjj0IZiW8sV
9MCNU7mYOmd+csPImI8NgOqbN9P0TPw3KIgJmc7yT5HmNyTKVuR6pQ/0+8eEbHkHOvSbz
ylkHS+bSRE6DHYnUrPyS2JunG41Lndjoa8IA4Z7rcTNje3VLrg0HnS1ZXolKUMfjbJvTL
4RT/8YRERAOsKgUkBT5PaSeqyD9Sk1IKkmuVzWKhr2BrsNV++opZdyI0VsiqmGYsihw==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792740382;
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=AMW0J07wOSd+yyZ9gMJBxPKEukP164cLLLMFPnFYBas=;
b=JCenMNb2o/bUCSBMfW8NqQECLPWcBZZ+3lbXcw3/ntY/3Uo/TZHG8qT90/3Uia/kbW+G
QfCuepfjIERIk06zy3dwS1R2AqhsJ5GEiYCGc2GKO84aI2bPzO9KlihY2shBsBa8si3tY
KBOipWcDfX4rUm6MBVhkEsZqhHTKpSRuUxSfqa2WkZNpueG5z6LHA2jtZVgzhE7u9gUfy
ZJN6lSgsykX81Wa0BCa7tSh85g58Sr58adsT1C2Zhzp4btWqc7Kr/g3+QQZm88mL0Ygaw
T0daJT21eut0md7sf9+zepD/CtLj7O2u/FuJ8xytrZA70gYIeB57httGkTzuMy4K1XA==
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=20251104 header.b=AbO7GZoU;
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 8B508606A327;
Fri, 23 Oct 2026 07:26:22 +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=20251104 header.b=AbO7GZoU
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.53
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1792740381;
b=DgVc9WNo09y9S0muX7PXkxCTfZEua7AslSNn+Ql35Lw45zO97LFCOxPW+sekmexoArN5
5PxKxO7KNj1QF6+0QGmpIN9reWr4oOkfAwYZRBSULhPy74YeSxSL04HdPUCeFjuxj6/To
RjwyFKhCOReskIjnKsRIVrcrW0hjsmVFCBhWLrTSXYB4XGb0oIlVGRFfzu8+tMgnA45cb
slDLe/LxV66McJxfFbjbFRdO0CkVedzhgHkfIqXlR0mOruEvYxwH/0SiaPInXYsZI+e91
Uo4krbWYeG77EdSUzFrKJRD46uwBfn9jJWVZlWQKmKkRdaMMY9RRiw40tUtEVAYvCUA==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1792740381;
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=AMW0J07wOSd+yyZ9gMJBxPKEukP164cLLLMFPnFYBas=;
b=ZTxCS8jyjBgCe6hJaJpV1UDCXXOly/JY70Nu/Dg6+bPAU1ReZjmMcHj3P5tpFKJGrnmR
lqfb9ox4jwvTgiSr0wfmZQj80thcSYztt9TR38GuhCjSvThhNAx90K6tUPFsXOD1UUBpq
vqiAoRyXGdv6kKzCZ3dVe0JEpRvnouksTab3+IfudecWH+GuGVkEqYbv8kf03MjMw+87p
lRDS6udJU1NLwVdRKrDNGDypD0dK5fhXG0/ww19rYFtY89gZiPi47K90lT4VcNftdgic5
RF6bVrZ1lqbCtNsAlngpJAdo1LEJ0aclvWDTPRMmSMnkgTWbftEXHOC0bdoi15ymydA==
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=20251104 header.b=AbO7GZoU;
arc=none smtp.remote-ip=209.85.221.53
X-Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53])
(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 5792F606A320
for <git@vger.kernel.org>; Fri, 23 Oct 2026 07:26:21 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5792F606A320
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-f53.google.com with SMTP id ffacd0b85a97d-48afcd7ba9bso278573f8f.3
for <git@vger.kernel.org>; Fri, 23 Oct 2026 00:26:21 -0700 (PDT)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20251104; t=1792740380; x=1793345180; 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=AMW0J07wOSd+yyZ9gMJBxPKEukP164cLLLMFPnFYBas=;
b=AbO7GZoUcSq3sOBz9FpcSfnG/oBcusKUSuhSDg3oIOURMEIBNIvzQLDvLlFAWtt+3X
10wHIc0hTov32BfcN0oH5jqiNmUPWAlcru5MLO9K9EmRaTipu/O5aLdP52SUdxatR3Ix
H4eccTOs3gikTNkAOMhNXDCV1FiKsvq+MLE0l1a7O6Ymd7MtEqK0ntY91DVAB1YDkOXl
imQutD14u+uEEq9ORpeey0yX1ETSn1f8kRnUDJ40TuxGaZ3pCsi2GjSN+VL7lyxmfpGY
gJvaiwfh7dmkvXZk0OwVu1wZ+vQ+iUGbWxs4EbTGK7QEiP4R1Q5Br8vyQtEquTo4Xa3Q
BBTw==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1792740380; x=1793345180;
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=AMW0J07wOSd+yyZ9gMJBxPKEukP164cLLLMFPnFYBas=;
b=hb8p8nh3x0x7q53kxDnnfVXSS5RrHnK1JORy3FC+g9Qzo9KEBOJzJxvzlJ4U6wY14X
FDYSrsZjEk/fJ1PK+nYnWw3TGzzRjvLApyrg+1U2SAuV0iYayUPfJ3g7dse53Gs8Jk8L
HlQfs+Y6ePKS/j3Ep+z7DdZZCx1hVWzVCAtpzNAP+SZZRbF8ACsVBj7rTNRyeZJdly5P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:ab24 with SMTP id ffacd0b85a97d-48e3854e27dmr1842770f8f.4.1792740379574;
Fri, 23 Oct 2026 00:26:19 -0700 (PDT)
X-Received: from christian--20230123--2G7D3 ([62.35.114.108])
by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e38055da4sm3228024f8f.43.2026.10.23.00.26.18
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Fri, 23 Oct 2026 00:26:18 -0700 (PDT)
X-Cc: Junio C Hamano <gitster@pobox.com>,
"brian m . carlson" <sandals@crustytoothpaste.net>,
Patrick Steinhardt <ps@pks.im>,
Elijah Newren <newren@gmail.com>,
Jeff King <peff@peff.net>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Christian Couder <christian.couder@gmail.com>
X-Mailer: git-send-email 2.56.0.215.g47fdf2208c
X-In-Reply-To: <20261023072559.3204273-1-christian.couder@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