From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=202.12.124.158 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796519285; b=RFiEmOdqM3yDVSaKBqyrWUregcmPuMFFbeB3HleNc0tCvhhhcfjAGFABvUKkeYq6G/xa 1RFSPciIalCE1FgFd7ayf1BwuYaGD29/Eqoe+IJRmVdUlZD7j7wNsJ9cVVDHUFIKnLQaD J+ltbZ276Yn00WvEl6KekXOmD2yGpl6OLZHEe+Uo/RHmQAAVM/depwZwbT2ID709O5usv ZVAC1+BeaziFfkeS3eGHO0f554I/p8kH6qqFAK2YJvzl8w9bqLAD8hAq7mGld6q4xlRNg u6rmBfqgoikYmPCry+LtOo7a/c/QReQev96tbRXHiO7bHa0EBElB4B37QkldNAlRPKA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796519285; h=DMARC-Filter:Received:Received:DKIM-Signature:DKIM-Signature: X-DKIM2-Info:DKIM2-Signature:X-DKIM2-Info:Message-Instance: X-ME-Sender:X-ME-Received:X-ME-Proxy-Cause:X-ME-Proxy:Feedback-ID: Received:From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: User-Agent:MIME-Version:Content-Type; bh=E+BfHR5lX3tuo2ZRHLEH9am3gu35rEnW8bSQADe9qII=; b=k77wEqZVYDEeCwe4ptbeFaaHMyUpY/sahaLKfUVnPzc7hYAVuO1dEVTaTJjjmnZ9SLmN d9N1gAahC7MdsPte0QxNx1wBeNm730NTDy09Wf4DBV0/F12dTvJPNFXgKV33EX0qAuhzx wt8MIC5U8sltlwbdxIDQhA7LX+mNmCnje8ZyfOWeutTjYrZIzjqSuUfSZatGFbmjFabt5 GazFtnohn47hmwOwOHHLnznRxxke7r0tnBqZJYXMv3Q3JQW//2jCirfZrXDRe40BDk4/g vqh3pL7bpsoAB3i6HABasQhsp7wIHK2FmZc5EstLm2PsBEexirL5Pf36p1KYijyajKg== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm3 header.b=orZxU9X5; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Rh+TGjZK; arc=none smtp.remote-ip=202.12.124.158 Received: from fhigh-b7-smtp.messagingengine.com (fhigh-b7-smtp.messagingengine.com [202.12.124.158]) (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 3C1D8606A31F for ; Sun, 6 Dec 2026 01:08:05 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 3C1D8606A31F Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pobox.com header.i=@pobox.com header.a=rsa-sha256 header.s=fm3 header.b=orZxU9X5; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=Rh+TGjZK Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.stl.internal (Postfix) with ESMTP id 724167A0122 for ; Sat, 5 Dec 2026 20:08:04 -0500 (EST) Received: from phl-frontend-01 ([10.202.2.160]) by phl-compute-06.internal (MEProxy); Sat, 05 Dec 2026 20:08:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-type:content-type:date:date:from:from:in-reply-to :in-reply-to:message-id:mime-version:references:reply-to:subject :subject:to:to; s=fm3; t=1796519284; x=1796605684; bh=E+BfHR5lX3 tuo2ZRHLEH9am3gu35rEnW8bSQADe9qII=; b=orZxU9X5M75EwVAWNFgbN/jzii aQs3lCIhPiGTIm6Z7vrcHWOUa6xZ+oC1pxyegItCOKZQX1xHKcPkcm3I3G8pwBfH AqKVeZ6W+rziB6SnehNT2FHMihNE/Q+9kFGUSn8lYJO2WgXOmwuG4S1mypvUjqxO MF9GMXn02SlCNRW068GYn9YY66iU0gzc2OKkVVDkMExJMqbeDjYOxgmCnRUP7b91 nr27W9LLV4aNTcma/CutuisqfAKnaA7NaPGR2fydCUgvBxmW1psf/7B9pW11LXJx mGcOyYSlXda8/uCvCpmvLCYp2gu820+k6shWcow5m5gDeZakt8SgNyvIshyw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t= 1796519284; x=1796605684; bh=E+BfHR5lX3tuo2ZRHLEH9am3gu35rEnW8bS QADe9qII=; b=Rh+TGjZKqCOPIaF2lc4JHx6BqKCA8uQXO06KgW+sp0Ej5gBmRVw xqThDlfjR5vHNcyCcp8kpXg4nH+j1Aln5d/TbV3H3ppB55prhP6LMQ0j4a8mGaHt jCJ+MisFAKh/r2GYx/CDjx+WqZvQJLzp+qW4Mlr2fuMKg02pJhkhZ27rwpPXAeJC cV2C3+Eotjii8/L+8F8+oniiXb/SytYa8MP0WGe0Ci8mS42EF7iABhPWL9hKGXJd FIdbzyLUmIgU0rBmKj/ADVUoG2haKYYk7bCk89yjDHW7HbJlJcmOWs8/fyrLT3Yf DbVDPoKIbiobOlQjRdwmfHN1bBeyyULfe9A== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pobox.com a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796519284; d=pobox.com; mf=PGdpdHN0ZXJAcG9ib3guY29tPg==; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm3:rsa-sha256:JXw87YQZRLBcRIcZ7f7zEGyTX9UZq7Isc+/aRJyngI0hPGT fyK/6KM0FSpNIo9oow2tjaD+H936mm9kv1k0XlRCG/DCarbrX/6WpXOvRvnjBZ9t z+4Ex99LSwlqh8myjWNxGzfb4FBvExpZDs+kPwhEDh76XAJR/m9LytnbMLS5UL84 M4OR1kEr0s06oZ2/xF3oMNdkq6/HeYPCxYlBdfZ97hl/JNk80DD+7qx6gc8H2bjw r5/E+FiE+f7dbwSTs/SM9CCnjMNO4XhbZ9t//Vh+h5nVloD+TjCaYffP3iFZ+aaP 6V6HbfkxB8zMF56TItFYwcO0bws7+6Om8m0e5NQ==; X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=mi-m=1; hc=12; hn=cc,content-type,date,feedback-id,from,in-reply-to,message-id, mime-version,references,subject,to,user-agent; Message-Instance: m=1; h=sha256:oOe24q7kDZtVDWeHcwYvq6zT8mR6xzrgo4iUvKTw+lA=:+H68+uF5TCPJpDoDaeeXr4Z7eIkeYnyZaidBB33tuaA=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTE7znzmQ3QtYR3778CVx4IjPcnrWANsndZpEySNKwi2EXPPtK0H12iUswm1ts6p26 IO1BYUAtQSRo2w7xH7OxAx4EMZeGQLERsEewK/1sXcuC0y6aGWWzk6ZnknLLDEod1ZKR1M CWpFu+HK2i/TNetjNPCbPnAHI6jDjjtOgNFUJBslaC9RjQ03qPEQgA1gHwGjOldg/QhgeA /1F9w+CKatR4nwLD2mHc4Thoh1v66Clk+vAvb4OFXeRQegLTUTITqRJ9jSmkUmbLaHk1WQ FFluzfDFtC+03duZDWAJwvaWPL9sBIo/0eSo7QpE63m7rIWdY1hFUMwUy1vRL4A6Q/MnHl z6qQbSloUcD/A2GhApPa4gBEP8BIFy9glR437aKiDFNtYr9gOmMNYogSWzRF8ybRxdtR4d eWTqO9jfMpsfYBxrSyjIshl9ilbO+0h3keXnn+4+XxKxoStKY22LQfKDVbEmZZcadJc4xb 8JUUeP5hR3zuBixA9WLYk8eX5OwUg/uIbz23YcitOKPGgEKXtx3kK8axADmMgbXd8tDdAU F1KzmljcZZuXeem16Clgw+2Dof1c9XYEBSfMEQcsJWRNtAVzyZfYJPekdl39eOMcLgVJCY vCjExpRvw8QnpvEWThjQw3noK4TEPmH3PT+w+YfzASW8iufDd8DpVfvJ74zw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Sat, 5 Dec 2026 20:08:03 -0500 (EST) From: Junio C Hamano To: Adrian Ratiu Cc: git@vger.kernel.org, Patrick Steinhardt , "Eric W . Biederman" , "brian m . carlson" Subject: Re: [PATCH v3 2/4] rev-parse: die when --output-object-format cannot map an object In-Reply-To: <5d5527aa404ecf02017dcc132c0a2879f8718c39.1795455594.git.adrian.ratiu@collabora.com> (Adrian Ratiu's message of "Mon, 30 Nov 2026 15:43:23 +0200") References: <5d5527aa404ecf02017dcc132c0a2879f8718c39.1795455594.git.adrian.ratiu@collabora.com> Date: Sun, 06 Dec 2026 10:08:02 +0900 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) 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 Content-Type: text/plain Adrian Ratiu writes: > Note that this covers every argument that names a single object, > e.g. "git rev-parse --output-object-format=sha1 main next". > Arguments that rev-parse expands into several objects, like the > "A..B" and "A...B" ranges or the "rev^!", "rev^@" and "rev^-" > shorthands, are printed by code that ignores the output format, so > they still print storage IDs. Fixing that would be a bigger change, > so it is left for a future series. The rewording is much clearer for positional revision arguments (both "rev" and "^rev"). Note that --default and ref-enumeration options like --all, --branches, or --disambiguate also call show_rev() directly and ignore output_algo, though leaving those alongside ranges and parent shorthands for a follow-up makes sense. > diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c > index d2154eac8d..f4b5a31aff 100644 > --- a/builtin/rev-parse.c > +++ b/builtin/rev-parse.c > @@ -1171,9 +1171,11 @@ int cmd_rev_parse(int argc, > } > if (!repo_get_oid_with_flags(the_repository, name, &oid, > flags)) { > - if (output_algo) > - repo_oid_to_algop(the_repository, &oid, > - output_algo, &oid); > + if (output_algo && > + repo_oid_to_algop(the_repository, &oid, > + output_algo, &oid) < 0) > + die(_("cannot map object %s to %s"), > + oid_to_hex(&oid), output_algo->name); Even though &oid is passed as both source and destination to repo_oid_to_algop(), repo_loose_object_map_oid() leaves 'dest' untouched when no mapping exists, so oid_to_hex(&oid) still formats the original resolved OID for the error message. Using the same message as pack-objects is nice for consistency. Looking good.