Article View: linux.kernel.git
Article #3234Re: [PATCH 2/3] rev-parse: die when --output-object-format cannot map an object
From: Adrian Ratiu
Date: Tue, 17 Nov 2026 11:55
Date: Tue, 17 Nov 2026 11:55
63 lines
12274 bytes
12274 bytes
On Mon, 16 Nov 2026, Patrick Steinhardt <ps@pks.im> wrote: > On Thu, Nov 12, 2026 at 09:57:39PM +0200, Adrian Ratiu wrote: >> This happens because rev-parse ignores the repo_oid_to_algop() return >> value. When no mapping is found, that function fails and leaves the >> id unchanged, so the storage id is what gets printed. >> >> Fix it to die with the same message as pack-objects. The other callers >> of repo_oid_to_algop() already check its result. >> >> This only covers a single revision argument, the one case where >> rev-parse converts its output. Other forms, such as "A..B" or "A^@", >> print storage ids whatever --output-object-format says. That is left >> for a separate change. > > This paragraph is a bit hard to parse. > > Note that this only covers the case where the user asks for a single > revision, as it is the only case where we pass the desired output hash > explicitly. All the other cases, like for example when the user passes > a range, do not use the desired output hash at all. Fixing that would > be a bigger change though, so this is left for a future patch series. Ack, I'll reword it. >> The test copies a loose object into the repository by hand, so it >> doesn't depend on whether fetch writes compat mappings. > > Do we have to do that? I'm mostly asking in the context of the new > object storage format extension, which may change where and how exactly > objects are stored. So all tests that manually modify the object > database will break, and we'll want and need to fix those. We can do it any other way, no problem. How I reproduced this in the real world (non-test) is by creating a commit with JJ, but I tried to avoid adding JJ as a test dependency. :) Besides, I'll fix this in newer JJ as well, to simply reject repos with extensions.compatObjectFormat, which is not supported either in Gitoxide or JJ. >> diff --git a/t/t1500-rev-parse.sh b/t/t1500-rev-parse.sh >> index 30bf8a4d0a..c15d9953a8 100755 >> --- a/t/t1500-rev-parse.sh >> +++ b/t/t1500-rev-parse.sh >> @@ -241,6 +241,24 @@ test_expect_success RUST 'rev-parse --show-object-format in repo with compat mod >> ) >> ' >> >> +test_expect_success RUST 'rev-parse --output-object-format with unmapped object' ' >> + test_when_finished "rm -rf plain compat" && >> + git init --object-format=sha256 plain && >> + git init --object-format=sha256 compat && >> + git -C compat config extensions.compatobjectformat sha1 && >> + oid=$(echo unmapped | git -C plain hash-object -w --stdin) && >> + # copy the object by hand, so that no compat mapping is written for it > > Instead of copying by hand, wouldn't it be possible to write the object > with the compat object format unset and then set it afterwards? That > should also ensure that we don't have the compat hash. Yes, I just verified that it works. Will it this way in v2, thanks!
Technical Details
Message-ID:
<87fqwzk6yv.fsf@collabora.com>Path:
mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!git+bounces-75603-linux-kernel-git=dewy.ruReferences:
<20261112195740.2834341-1-adrian.ratiu@collabora.com> <20261112195740.2834341-3-adrian.ratiu@collabora.com> <avqynlDKnJpJn6RZ@pks.im>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-lax.pugleaf.net!srl.newsdeef.eu!newsfeed.bofh.team!nntp.comgw.net!eternal-september.org!feeder.eternal-september.org!usenet.network!.POSTED!vger.kernel.org!git+bounces-75603-linux-kernel-git=dewy.ru From: adrian.ratiu@collabora.com (Adrian Ratiu) Newsgroups: linux.kernel.git Subject: Re: [PATCH 2/3] rev-parse: die when --output-object-format cannot map an object Date: Tue, 17 Nov 2026 13:55:36 +0200 Organization: Usenet Network Message-ID: <87fqwzk6yv.fsf@collabora.com> References: <20261112195740.2834341-1-adrian.ratiu@collabora.com> <20261112195740.2834341-3-adrian.ratiu@collabora.com> <avqynlDKnJpJn6RZ@pks.im> MIME-Version: 1.0 Content-Type: text/plain Injection-Info: usenet.network; logging-data="2320839"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:ZyV6ndYCYnB3ZTAT0HL+DapNYKg= sha256:i1wCgq88Y6KtjoCqw42aVkhxgaZCz7yHIuz8YuyZ+gw= sha1:O83FrpJEJwXrGiOIGVMnZbOJSKs= sha256:uja3UzltYeGbuv7pIpoA8wxf24ivjFy5fueb6y1S74U= 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 58965114F35; Tue, 17 Nov 2026 14:56:42 +0300 (MSK) X-Virus-Scanned: Debian amavisd-new at usenet.network X-Spam-Flag: NO X-Spam-Score: -2.75 X-Spam-Status: No, score=-2.75 tagged_above=-9999 required=6.31 tests=[DCC_REPUT_70_89=0.1, DKIM_INVALID=0.1, DKIM_SIGNED=0.1, 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, URIBL_BLOCKED=0.001] autolearn=ham autolearn_force=no X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=fail (1024-bit key) reason="fail (message has been altered)" header.d=collabora.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 I6nvTJim-Pvc; Tue, 17 Nov 2026 14:56:35 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=104.64.211.4; helo=sin.lore.kernel.org; envelope-from=git+bounces-75603-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=collabora.com X-Received: from sin.lore.kernel.org (sin.lore.kernel.org [104.64.211.4]) by mail.dewy.ru (Postfix) with ESMTPS id B9660114F30; Tue, 17 Nov 2026 14:56:26 +0300 (MSK) X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92]) by sin.lore.kernel.org (Postfix) with ESMTP id E3A7424080; Tue, 17 Nov 2026 11:56:23 +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=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794916580; b=h0kP+rbABq2Z1H4Egc8bfYJFPh+IWe3+isEqejozzrtM+yqXTyu7HyuCNJY8bTNsMHKg 7+rqz1EpyRM0bRR+MHPY22tGyBa8JdqQPLAnAshu1ugApDi8R9MG3P++/7SU9tknrOVLl WyaGdgx6C27VkfyOxHVSKHHvI4JyeVyd7t5QIOLGmFnU0kvDqQqrfAE9WefJ2/5+SufaB R+MUc2mxvzGIGANgOycCKNubXGohRUMbgZPbu6VosoHe9hqSXCPZRDrocEmm07jiYilhB btJiX47mGEuHqljSAaucnpHnc7jeYTl+zcfMSKTaSHcPfUB92wRVBHKm7+P+grcPTmA== X-ARC-Message-Signature: i=3; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794916580; h=X-Original-To:Received:DMARC-Filter:DKIM-Signature:Received:From:To: Cc:Subject:In-Reply-To:References:Date:Message-ID:X-Mailing-List: List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe: List-Owner:Precedence:MIME-Version:Content-Type; bh=ekGjFzOcuR9z+yNs84AGw0IoXQAziJJC63WSR8k6ujs=; b=s1ew3ucG7QQfKKDRFEKBme4wOEM703t9h5aJI6khoq7rW8xrCqtVB/+v87Wq4ZarVJV6 vSMdK8RIj0ydrt1KJnuIkGEqjkd2vh2RvDWx2Qj3ObXq4BQjoEiFyJ5N9Upl5og0INYWP U1EvsDnd2Sup73FdRJh4UTQeP8KU4UI2Wi9qzD4CdktxsjpvyEJ1rJP+rRxbMA9x1c5iS M1gYxD4NNhIhcBH84qvwNtkF6VSnBxVNY8rbAHQchr99ZfxqHpmfBnB3eLoYaKqK+0kzD /DOmIUsMu1urL31aE3Tu/sfHouNIB8MI+m7IS9jL2xWPqe5txQN3xMs1thj/CLzOBdA== X-ARC-Authentication-Results: i=3; smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=zohomail header.b=gqL5uCUi; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.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 7AB7D606A331; Tue, 17 Nov 2026 11:56:20 +0000 (UTC) X-Authentication-Results: smtp.subspace.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=zohomail header.b=gqL5uCUi X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.182.12 X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass; t=1794916579; b=cnbTZYCF0AtsG1cJCzXZ38ef6BdF21mvYuFAeuu9dZ1JyJamU8PPAEDihB6z6C5446YY gW7SkjHx3pdUb78hDM2YmQKa7vKIK7VxLDEW28HWQsDjeVS7Jbczc5ZgPJwFDBFc/R7YO DKFeWuerLcRBCvFRxyucnbAHczit7DDn9jwF15w2yTMyYVVvl6xj7HgdcJH4hJIs3FcJW uU3Uj8IpImwTs6I/56AK4OGdHY6ckl4/eUVXyqf/PwTOVF4Cv0MpFbtwcQfGyI7440i0m Z6XLp+9VgwnQPwfdGDdSEuq++lqmI+m4k7t+uubAXgO6vAmPQuwI6xEpBSDvYZtoV9g== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1794916579; h=DMARC-Filter:DKIM-Signature:Received:From:To:Cc:Subject:In-Reply-To: References:Date:Message-ID:MIME-Version:Content-Type; bh=ekGjFzOcuR9z+yNs84AGw0IoXQAziJJC63WSR8k6ujs=; b=LZzqOEtI32cEvIwGy/cwcpM4Fu5O9itAo/7N8u69iq54OUXVFQV8ena0YZb5mjArhGGZ G/gn8jipACFigwVtYmKU7+CCILAzZ0bg0qSOf+2/A36rt1qyRssGN+41uFlWbqSUS7EfR GDuzwN3p4G3dd9WbC7Z3YhZgLpgBSyU+MKzswatpcelwSpem9cQb2TukdklCeqsePOQsN Ozd4opvhUWE7esqD2TdkHK2nohsQipo3XcniPaBaRYOu5I/wpIIszjzMwDiErzeAKgJ50 5pdIodvdaNP0cvOA/6+TIg+5auIsr2FUitHbAa8O0aX6vHRBTw87z4Fu0imptQ30K0A== X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass header.from=collabora.com; spf=pass smtp.mailfrom=collabora.com; dkim=pass header.d=collabora.com header.i=@collabora.com header.a=rsa-sha256 header.s=zohomail header.b=gqL5uCUi; arc=pass header.oldest-pass=0 smtp.remote-ip=165.173.182.12 X-Received: from sender5-op-o12.zoho.com (sender5-op-o12.zoho.com [165.173.182.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34C42606A329 for <git@vger.kernel.org>; Tue, 17 Nov 2026 11:56:19 +0000 (UTC) X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 34C42606A329 X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=collabora.com X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=collabora.com X-ARC-Seal: i=1; a=rsa-sha256; t=1794916544; cv=none; d=zohomail.com; s=zohoarc; b=M8c7hvNh/6oLZlgske/q1VDGMObxM+jxbwnVfMn9i+wZdNi6hCA9OYfrMGiKeidAeKafXrEDzKL4RJXa7KPUx2n42UwzhBwam1rShJbZ4VnaEowUNXqTYTzfo2xBpUQ32qKhvilCnKfS71nyDo3yC8BdPrjqHhWvGG/HgeMgEcs= X-ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1794916544; h=Content-Type:Cc:Cc:Date:Date:From:From:In-Reply-To:MIME-Version:Message-ID:Subject:Subject:To:To:Message-Id:Reply-To; bh=ekGjFzOcuR9z+yNs84AGw0IoXQAziJJC63WSR8k6ujs=; b=cV8Et/uySRjinxxCdHJRTmliQpobmgc+U9ESR0PC1VBjxsMIvAfPp3epL/LXvh02oaRBDdAEKJuxPlRtnGrKiWYDS3zC3+yTJC6MkYZaQR6PsKasT6gJyMnxDDlKpouV+YOGE8XpuP3eWCwg4LYxZZZqF0LbOWdNDoWhZFWIIZo= X-ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=collabora.com; spf=pass smtp.mailfrom=adrian.ratiu@collabora.com; dmarc=pass header.from=<adrian.ratiu@collabora.com> X-DKIM-Signature: a=rsa-sha256; b=gqL5uCUi1R8H7t9OtHr/12Sfi9hSCKqfPdlbVIGBT27ebprfA4c8YcQSGEVcofXddT9ktoelA18Gv/4HKNc/JazxZZUh2oj++zIQkPbmLDpDIAZxpvD+tHChrJ6MM4Hz66LazxfKfUVjfQTI549edNRP05rOCJanvw/s5oEpnEg=; c=relaxed/relaxed; s=zohomail; d=collabora.com; v=1; bh=ekGjFzOcuR9z+yNs84AGw0IoXQAziJJC63WSR8k6ujs=; h=Content-Description:Content-ID:Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Owner:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Resent-Sender:Resent-Cc:Resent-Date:Resent-To:Reply-To:Resent-Message-ID:Resent-From:Sender:Subject:To:Date:From:Message-Id:Reply-To:Subject:To:Cc; X-Received: by smtp.zohomail.com with SMTPS id 1794916541728348.29145203067446; Tue, 17 Nov 2026 03:55:41 -0800 (PST) X-Cc: git@vger.kernel.org, Junio C Hamano <gitster@pobox.com>, "brian m . carlson" <sandals@crustytoothpaste.net>, "Eric W . Biederman" <ebiederm@xmission.com>, Axel Rasmussen <axelrasmussen@google.com>, Emily Shaffer <emilyshaffer@google.com>, Josh Steadmon <steadmon@google.com> X-In-Reply-To: <avqynlDKnJpJn6RZ@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