From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.210.172 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== 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== 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 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 ; Thu, 3 Dec 2026 10:37:26 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org D552C606A334 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com 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 Received: by mail-pf1-f172.google.com with SMTP id d2e1a72fcca58-8a0880a46e7so530799b3a.1 for ; Thu, 03 Dec 2026 02:37:26 -0800 (PST) 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 Ozl1gxhBZg9jfWXTv2xpis99uAM//tF0d67dXeEV3Mb0FgPSlIkr08JmimQZktKC+V+/ ow5mCU+zS+v1jJuZ2OJfFsTEUlM1YyeGv1OwEPY5M0f8y1+DjBwW4hvqXBm39eUqvmWj KJINv427NOpwLiOKCln3ndDafKmmx14MDwMYt2WQh4Jd+kyIr1SElwSsfuHydVbrJu6z Oij8Q5uDOBfwl8ZWOp2FiLXSPljIwWu02KtNbnBRQeN0eCvFnfsk+eW8ygyJ2T8byii5 nLTw== X-Forwarded-Encrypted: i=1; AL+hErGxc8vJPjH2PwF6Ptk/eepxLeyCSw1Ke8cRon3tgYHOR/+c76dyhvV7zP8yOtuIVc+jf4g=@vger.kernel.org X-Gm-Message-State: APuU4Z8FnZPHFdeerG3Z937HFGY6oUeRt/Ygm3PDOILvqsguRPH8gRuN jKDOx96P7Q9I6KjeHTzS/vGzv4iMWI1GbiiJnCyoLiJNJ+7FSUsT65qY X-Gm-Gg: AZFdTZeb4NThlh3hEHRYJocbaa/7Lp5KUSlKhqrF0+TXt4W/F5MFoht9phwYRxtJ7GX mD7dSkKf0Zu+E+/+CTAHjLAe6Wxs1HDzKYyDva1BsQZ3/SerUDQRG1ePK/c/XKyZdyew2Fe6wep qmeg/1oM8v38ANUgcAiRMt7UCRw6tWouwhM5OMUQ8lPJrdk/yG0jExHY8LEIIX2afRHxoLgj5jK 41cM0WlDCZZSJjVvr2bsc6SMTuQMOaNocECl/dw92cFo9pPx4GPhysFTHwxn2/DG6FpP/CCMARx Y3ZpmNXWyCgonobpHR3pdrDv5cu71tcQqna/8pu8Z0E1QUuG4f80QGH6o8y1otYliez+Ygo+/eI qxpW+KCE7W2tI/y+96UNkbgPf4Gs85Hnszi6wYJBXTPUD/1feFYdIrzKy2DMVz5pbPJ4wY9HPsi J66a7aG/EPbBaRIzROqon5DyIbjQvXSehMP9ZqMzno1RSJMZm1+KPglab8NBi5BP0rue3JQ8mWv 4kqm9Udl13dOQlesl5IA0zBlHlymbxuQ6nl3kSn3v+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) 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) Message-ID: Date: Thu, 3 Dec 2026 16:07:22 +0530 X-Mailing-List: git@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 3/7] commit-graph: simplify reading a single commit graph To: Patrick Steinhardt Cc: Junio C Hamano , git@vger.kernel.org References: <20261120-pks-odb-pluggable-commit-graphs-v2-0-31f2341a9932@pks.im> <20261120-pks-odb-pluggable-commit-graphs-v2-3-31f2341a9932@pks.im> Content-Language: en-US From: Kaartic Sivaraam In-Reply-To: <20261120-pks-odb-pluggable-commit-graphs-v2-3-31f2341a9932@pks.im> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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