Article View: linux.kernel.git
Article #4300Re: [PATCH v2 3/7] commit-graph: simplify reading a single commit graph
From: Kaartic Sivaraam
Date: Thu, 03 Dec 2026 10:37
Date: Thu, 03 Dec 2026 10:37
75 lines
13751 bytes
13751 bytes
On 11/20/26 17:52, Patrick Steinhardt wrote:
> diff --git a/builtin/commit-graph.c b/builtin/commit-graph.c
> index 8194a528406..2a5a75dc22f 100644
> --- a/builtin/commit-graph.c
> +++ b/builtin/commit-graph.c
> @@ -111,7 +111,7 @@ static int cmd_commit_graph_verify(int argc,
> if (opened == OPENED_NONE)
> return 0;
> else if (opened == OPENED_GRAPH)
> - graph = load_commit_graph_one_fd_st(repo, dir->abspath, fd, &st);
> + graph = commit_graph_read(repo, fd, &st);
After this change the dir is no longer set for this path. That should be
fine since it is not used here or in commit_graph_verify. It may or may
be worth mentioning in the commit message.
> else
> graph = load_commit_graph_chain_fd_st(repo->objects, fd, &st,
> &incomplete_chain);
> diff --git a/commit-graph.c b/commit-graph.c
> index 9e5656992eb..08a151af29a 100644
> @@ -508,9 +505,11 @@ static struct commit_graph *load_commit_graph_one(struct repository *repo,
> if (!open_ok)
> return NULL;
>
> - g = load_commit_graph_one_fd_st(repo, dir, fd, &st);
> - if (g)
> + g = commit_graph_read(repo, fd, &st);
> + if (g) {
> + g->dir = absolute_pathdup(dir);
Nothing reads g->dir between the place where it was set before and here
for load_commit_graph_one. So, this looks good here.
> g->filename = absolute_pathdup(graph_file);
> + }
>
> return g;
> }
> diff --git a/commit-graph.h b/commit-graph.h
> index f0e7cc93461..8660c7fe698 100644
> --- a/commit-graph.h
> +++ b/commit-graph.h
> @@ -117,14 +117,12 @@ struct commit_graph {
> };
>
> /*
> - * Load commit graphs from the given object directory `dir`. The directory may
> - * be given as a relative path; it is canonicalized internally so that graphs
> - * loaded from the same directory compare equal regardless of how the caller
> - * spelled the path.
Do we need to capture the canonicalization note somewhere else now so
that we don't lose it?
> + * Read a single commit graph layer from the given file descriptor. The file
> + * descriptor will be closed regardless of whether loading succeeds. Returns
> + * NULL on error.
> */
Also, is it worth mentioning that this would leave dir and filename unset?
> -struct commit_graph *load_commit_graph_one_fd_st(struct repository *repo,
> - const char *dir,
> - int fd, struct stat *st);
> +struct commit_graph *commit_graph_read(struct repository *repo,
> + int fd, struct stat *st);
> struct commit_graph *load_commit_graph_chain_fd_st(struct object_database *odb,
> int fd, struct stat *st,
> int *incomplete_chain);
>
--
Sivaraam
Technical Details
Message-ID:
<b2fbb878-0bd9-4bfe-b337-8fb9bc4edb0d@gmail.com>Path:
mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76948-linux-kernel-git=dewy.ruReferences:
<20261120-pks-odb-pluggable-commit-graphs-v2-0-31f2341a9932@pks.im> <20261120-pks-odb-pluggable-commit-graphs-v2-3-31f2341a9932@pks.im>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lon.pugleaf.net!feed-eu-txt.newsdeef.eu!feed-eu-ch.newsdeef.eu!srl.newsdeef.eu!newsfeed.bofh.team!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!git+bounces-76948-linux-kernel-git=dewy.ru
From: kaartic.sivaraam@gmail.com (Kaartic Sivaraam)
Newsgroups: linux.kernel.git
Subject: Re: [PATCH v2 3/7] commit-graph: simplify reading a single commit
graph
Date: Thu, 3 Dec 2026 16:07:22 +0530
Organization: Usenet Network
Message-ID: <b2fbb878-0bd9-4bfe-b337-8fb9bc4edb0d@gmail.com>
References: <20261120-pks-odb-pluggable-commit-graphs-v2-0-31f2341a9932@pks.im>
<20261120-pks-odb-pluggable-commit-graphs-v2-3-31f2341a9932@pks.im>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Injection-Info: usenet.network;
logging-data="2460736"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:Dgmm9gOSM0ROLr/VOSuygNbdsYw= sha256:XN8GmNMplQ6fz8KJIrScQgnvuFFuQjLYV2Vsc94Ie68=
sha1:7ZgZOWOh29iZatTr4x2j0RbSOE0= sha256:HfM07F6ZHh2smBs3tTJeOslivMZYk7Vikiw/YS5plEU=
Content-Language: en-US
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 624251178CC; Thu, 3 Dec 2026 13:37:43 +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 JpaQkAZa71Fe;
Thu, 3 Dec 2026 13:37:40 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-76948-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 33A131178C7; Thu, 3 Dec 2026 13:37:32 +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 953622C8DE; Thu, 3 Dec 2026 10:37:28 +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=1796294248;
b=fHlgU2ksGXz+9z3IoeS/8Hp9rSslnsgOi2i/QQPVHT0aZCArgE9MvViQ4Out2/+E0sxO
EoLxbxIiXnUi1H7tGPS0dicWyM8yfoNu9jBcVLmEDiSJ8pTXtcHqPJTC/YgAcV47GWhB1
AreDeyMyv/zwWQptxh6xI+16hq4CzmoO3peizrgJmDt5PA6FLvvQ2NYUCImGYFGcJpq/m
mqppSbZmjAtt04e/AFgwdSFN60GJZ3hTZkxEULtWYuwyS/U+C5SHoiJgIKAMOPufZ7up1
JElTLvitm4icYLwxiqwhLEoWN7gESz0R+qBSJ02iGdPjY2iNii+qPkaWVKPD2pAltPQ==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796294248;
h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
X-Google-DKIM-Signature:X-Forwarded-Encrypted:X-Gm-Message-State:
X-Gm-Gg:X-Received:Received:Message-ID:Date:X-Mailing-List:List-Id:
List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
Precedence:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=9Gj1PGfsBnuBn8piXNk27qcftPKeSJ9Nc5nItYDvSIg=;
b=pp9Zbh2T7xJ2Hu9Jk2vQqVgi5bPqHwF9qku6Aazj4z4qpggrvSrXOn+gHL+8Ytgl4sLD
bco2h3rvF4xbkn2mMYMo/fbzzmZPlq5qcPO66zhqStjvcCIjcHlEpGzG2rgmYaLZg6sjM
ZmI77+g69p0lF9Q55NxU/JymA75Bg8et1m9lEuSabDDUqCwNB1YrBKS4JokGGLee4zIoJ
5hwIsxG9ks0PoOyhkpGZ3zwWgTmnEUf/Xu4S4q+nKLfVMOYUkvTEFbUgvSJ3dGpIO/MKK
GvJjBnuvyc6GV/MsPCIpSGOoB2ET86J8NPjYIE8aVY1xorT16qfilBfYBmdOW4fGYWQ==
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=TCTYifTV;
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 1C2C4606A337;
Thu, 3 Dec 2026 10:37:28 +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=TCTYifTV
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.172
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
t=1796294247;
b=BPxxEUkm6hyIn9uQRUw+8OkywBhuEbC28Twnn4Bs1o/Ldje2/ton02TYK6PmpcS7NJsI
byO5VVhkfhRPSH2W1jhrXQW8vtkbLtxoIGrczVer8HBUsR698XiimzEmwxaJDHnbKgalG
majKqnVnEw2ahE+0LqKWkYu6cCwGkxF65YJUQwYOhqzXde526hmINhj7Dd99ePW4mEJi9
2Niz0VB1KwLXYHf86fgndi5Xp0y9YGTosWk680m1pyV3rvAE/GnPYC/VDPwJP6/VzmASU
DZw9EXzasBrQmay8CHi9xEjXHFO09iEuT62OS7aiTmrU4kW0+w+WGtABFxB7/CYtQyQ==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
a=rsa-sha256; c=relaxed/relaxed; t=1796294247;
h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
X-Forwarded-Encrypted:X-Gm-Message-State:X-Gm-Gg:X-Received:Received:
Message-ID:Date:MIME-Version:User-Agent:Subject:To:Cc:References:
Content-Language:From:In-Reply-To:Content-Type:
Content-Transfer-Encoding;
bh=9Gj1PGfsBnuBn8piXNk27qcftPKeSJ9Nc5nItYDvSIg=;
b=AJcdtfBO2VBirxBPuBg8CTWhsJQDWCGQGej0IkyFEwvfaPINMVLuLLzGRcQNkmG2ITzv
mvL/7kWxrISTYMKwyldhe5+feYKUrgrLFTMr7RlMaf0raDDMuUlSghYSGkeU8tY20fzHO
4pFDWa41tJ1fFzNugX6pulaGWYylVtrrZOOQu1vCpynN796nYhO9NuDcF4nQhOcPWrSAo
JHKjV/OqIVftbyxCvsvoSuC8Rx509JRAmo6RYmby2Ldna9nv47ACXRA9cBpnxA0uboPaD
VYlveSTTRnJcqFehxiKvrtDJoLlVPlskYsRaIIHZXwawwqc5Pj0xrbGZBE864tnnBiw==
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=TCTYifTV;
arc=none smtp.remote-ip=209.85.210.172
X-Received: from mail-pf1-f172.google.com (mail-pf1-f172.google.com [209.85.210.172])
(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 D552C606A334
for <git@vger.kernel.org>; Thu, 3 Dec 2026 10:37:26 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D552C606A334
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-pf1-f172.google.com with SMTP id d2e1a72fcca58-8a0880a46e7so530799b3a.1
for <git@vger.kernel.org>; Thu, 03 Dec 2026 02:37:26 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=gmail.com; s=20260707; t=1796294246; x=1796899046; darn=vger.kernel.org;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:from:to:cc:subject:date:message-id:reply-to
:content-type;
bh=9Gj1PGfsBnuBn8piXNk27qcftPKeSJ9Nc5nItYDvSIg=;
b=TCTYifTVp/1npKDpOCC17ofG9t1vZ5WxE0qd+V0nf3rmV8BBLDyilzljWGWvRYQNpm
jxtIXPk80ibQeJBV4bqP4zCatFMdkzLdvB4VwDCTjpRGcYAInO3kBsOHAESj4P5KmbBp
5GZoFLm/t5pzYprpLywNH5xenoI1/bSzbTeJit5m9sEuF0PxnKZkHxfvXeEt1s1Ekhda
8bWlRXVWM3uSTvL9fHIf0CxRi0ypq/qqCv2ol/ZJ9AWhhQUTesruxFA/iAokex/FqJPC
0RH2SkU3v9Vs8zGEnnIjUKharrmhoEinGNc3+onDs86Zsb3jhQqtIqhiN4p64bVLSO2b
mv1A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20260707; t=1796294246; x=1796899046;
h=content-transfer-encoding:content-type:in-reply-to:from
:content-language:references:cc:to:subject:user-agent:mime-version
:date:message-id:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
:message-id:reply-to:content-type;
bh=9Gj1PGfsBnuBn8piXNk27qcftPKeSJ9Nc5nItYDvSIg=;
b=t2R2q0JNWsD6sGPKOdoBKVr8nfqofJ3guLwJwfgqswhtlEftXXZKtTSiMGZ9Ce6kIT
Oz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HlymbxuQ6nl3kSn3v+uC0xNA6K3kbkY7V8mMiKEP8uSCRDaNSOm
zvNfNmgL+z4SRnJWFE6tFIvgqLOPS5g8kL4tYQP6Sw==
X-Received: by 2002:a05:6a00:4398:b0:881:e266:c3d8 with SMTP id d2e1a72fcca58-8dccd99d1f6mr1222420b3a.35.1796294245876;
Thu, 03 Dec 2026 02:37:25 -0800 (PST)
X-Received: from [192.168.1.34] ([103.215.237.233])
by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-8c873f16b41sm23481792b3a.56.2026.12.03.02.37.24
(version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
Thu, 03 Dec 2026 02:37:25 -0800 (PST)
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
X-User-Agent: Mozilla Thunderbird
X-Cc: Junio C Hamano <gitster@pobox.com>, git@vger.kernel.org
X-In-Reply-To: <20261120-pks-odb-pluggable-commit-graphs-v2-3-31f2341a9932@pks.im>