From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=103.168.172.159 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796394386; b=cWWy9miALGSeY535WXoGuYh+QJ/QLC9plJitEszcURrvMQ2dMr0kJC9+Z+VPgvDw320X qJ18cOkgsSmsnnG4hKVYlU9DK5RS2Ot2XzSEKXllPDIT1pP3n1R2EerQomirOJ2hlNv70 biMk1sfIb7Q8JGCO2hitGCH1PMhjmVnnYcSnfAWSftYRuRe6bW/GxCw3c26xPlkXE+ooK 6e+SCmMfNhPFpGj4k6qeIQD6atgXscVedmMfslfyY/LWWJ2qKodHOxsb0daPqBND6Ot0f GMIzzxMWbyDUCyoi2Mg76iR/vuWISAFNn0jbf3flqN+uQjO+sBlVI6WOypM/hDOuVdw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796394386; 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:Received:Date:From:To:Cc:Subject:Message-ID:References: MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=WP2EJyFt7NQd4dsskLp1h9sHrXlrL8Rf5Lv+ZikT+4U=; b=s1YRENNztABa/u4xVHEaE7odJ46AfaEMytpMym5dcMYjPy8Ygkq2jBzIiapbOMXUyvZH UNyzoj2JjZR29hXNxk9fMp9J7oYKA3qA/zmNMiNNGeTSdt5zfDhI4fF3C6LNFscMpufQP EPbDC85MdtRIZa0K9MZ3TAy8jMisM1rsDMg8ZCXdP030SP0Lk4q306TOyw9VPKXxzMNZH m172rE7yEpytZZJSHhV/iWvvOTVUHJY3VvKMOzQ8/kMXSFZJ7+r/9BnCwVdYXF6m+Bafh EPYOQM2qV1CKwcVMhJMUMHOr/8vzfgKd58FfdEBZZT9irt+rHC7OzvUp894I8oQC6ug== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=pks.im; spf=pass smtp.mailfrom=pks.im; dkim=pass header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm1 header.b=IpoYMtPF; dkim=pass header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b="ycEl/DEa"; arc=none smtp.remote-ip=103.168.172.159 Received: from fhigh-a8-smtp.messagingengine.com (fhigh-a8-smtp.messagingengine.com [103.168.172.159]) (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 EC085606A32D for ; Fri, 4 Dec 2026 14:26:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EC085606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=pks.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pks.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=pks.im header.i=@pks.im header.a=rsa-sha256 header.s=fm1 header.b=IpoYMtPF; dkim=pass (2048-bit key, unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.a=rsa-sha256 header.s=fm1 header.b=ycEl/DEa Received: from phl-compute-06.internal (phl-compute-06.internal [10.202.2.46]) by mailfhigh.phl.internal (Postfix) with ESMTP id 30420140011C for ; Fri, 4 Dec 2026 09:26:25 -0500 (EST) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-06.internal (MEProxy); Fri, 04 Dec 2026 09:26:25 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pks.im; 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=fm1; t=1796394385; x=1796480785; bh=WP2EJyFt7N Qd4dsskLp1h9sHrXlrL8Rf5Lv+ZikT+4U=; b=IpoYMtPFKToxoR7vMPkY+7dRJI cfJWraCh+k0z2Gb2Woa9zBHroyOPUEVwVnq5qPBFCCyhoTg1i1+7WhoE/AruWr6J fU7XwwuDgmBUF4HWCa9yDAfEUJ65ScNo5IE0mNlRFzPsc/PIgmwYiyIskBrO7PjF S6T4LPOQ8R/vZBqbq3q5f1K1bOlEP3V1HhBBTq54lkQXggP1P1UV2Rb0iRyt2opZ UApXRg23Fcrcg5rLLLZ5dMHyAAo5lOpqbodxamPQ/r69VJxsY8PiUpUG4oKv/LLd sJh0bu/4iejxC64aWLFz2s9vG9wcsZ85w8sBMCMsIyU5cfdKwbutrdCml9vA== 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= 1796394385; x=1796480785; bh=WP2EJyFt7NQd4dsskLp1h9sHrXlrL8Rf5Lv +ZikT+4U=; b=ycEl/DEaOlxhq9Gv3QqV1f9QZIVQ9udzam3jDyzdTTpLubs7gyc MohSi7tKk+nxqYtvFYfB0yKkf7Mfi6WXP/Obgou/RjLu4urTQHUuyY4XnDQ89Tiz 5GLhM7ldVHBOzM8okwirduxKacM7G+cOwnLHFjpzH9GMGWy29wbUBDEQokKdtueX zKrrI1igx2ZFCtDjlhClPbXZd/0BoFHQv/D52KFW4A2FNJq7TOmNiK06iUbSpcJ0 /Nn4cLXImDKvL05y8ZOEnrd+jP1fglqPEInq8Oqa9DaOJcPep9PL/4ynCJzA+75V OuBjojWcNLRcZp/GgXv3FZ+Q1EmrkYMdXqw== X-DKIM2-Info: draft=ietf-dkim-dkim2-spec-09; repo=github.com/dkim2wg/interop; date=2026-11-03; sw=lmtpprox; action=sign d=pks.im a=rsa-sha256; DKIM2-Signature: i=1; m=1; t=1796394385; d=pks.im; mf=PHBzQHBrcy5pbT4=; rt=PGdpdEB2Z2VyLmtlcm5lbC5vcmc+; s=fm1:rsa-sha256:XPTIT2iJ/t69H5WaCieLhKOv3Xe8onJoSs8Ad0i7Ijeemer H5X/5mhu4BYk+ZIQM0aZGIKEgMVR+hsNlhYr1RTUlCC+dc9g/nPZJFRCnIBNmBIX Mt5+z0lKDtqNTqnJEry8B2KhomfYaQiudj3c89doimejkUvDk9IAuhAIv26PUD/v /TXCt3zkU7spAtx2oVE16p21dfIX5Qx73HyW2e8qyvebVQOzpcRUqh5B75+dU3bi /gPjO3xjheCSzyOFU/7OfzI5I9cr/BNi3BPRjBoQEZuW6U7YCUyOxRHcg+4VwuOW wjkWo3hIlaJiMz6ltSccyu112yL7w9aeMTk/pOA==; 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-disposition,content-type,date,feedback-id,from, in-reply-to,message-id,mime-version,references,subject,to; Message-Instance: m=1; h=sha256:1QiAdN1SPUcuEekLPpHDKfNqQ6nqcSjqeRHeE24Kclo=:6OVCTXkrBEdfNfeTaZyMd4KrItRjoTRJjqjuncv7PjU=; X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: dmFkZTG02H66B87/xnRvdwIWNwlFUTX7fdUn7vccMIXLr82LGb52QUhZ4cYOLWxAja5ojO Bib31dHjVjZnn+yFKGhLpqGypejGBIMUtZCjwgNqe7tFmA7bIB+Ciia7IDCOVrwtEikdU+ 4l1ORvD5xfev+4co1XK084kcsr/vDoszWwL1Vj+e2OqS6T4j/J49XqtCLjaO+JgMCwBGt4 IOj1ObtvnCHB4yuSiOat2c7tyqQtC/fW7v2LnVekWCkW6/fPrpGA6vQEXHp/yvq0a0lG7R jY5U2baQn8oXwNJDU4SFF1ZByxgEsu1I/on5UDtwVyS53FXwFFSrLT50G7LUrMlfMXDgQ7 X5rhsYU7ey/Xz/kOLk4w2TugQ28Y/ztwbj6ZsVLbUfBvYka4kSi2iFdfCU8GfGqfNHwx10 9jPyfeQonr09IL8IBuTysVw32gsWkJ+0fmKBE8/merAaBash0eZTb+weSgfIqiN8PPb94f X4wsS4lfMeD6LNOo1ugvDgs39j0uy0FComY9/yKFiQwB/vma9lWuE9F5Wrhwc49Pgg7tJu ANHsvhl0zuz1rUAtsi3qiq03rnSkKU6QgNuSz30bl5ej2gcXK13QdAhg4VrIB5+MU8+rKK uECOQSRxjSjF05NPIF33n1S3hFDrX0BeKXE1h30oNQkwhBQNKcMBRH3bbxng X-ME-Proxy: Feedback-ID: i197146af:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 4 Dec 2026 09:26:24 -0500 (EST) Received: by mail (OpenSMTPD) with ESMTPSA id fbdc5bbe (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Fri, 4 Dec 2026 14:26:23 +0000 (UTC) Date: Fri, 4 Dec 2026 15:26:20 +0100 From: Patrick Steinhardt To: Christian Sagstetter Cc: git@vger.kernel.org Subject: Re: [PATCH] rev-parse: accept a separate pattern for --glob Message-ID: References: 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; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Dec 04, 2026 at 05:38:55AM -0800, Christian Sagstetter wrote: > With a branch named topic/one, "git rev-parse --glob=heads/topic" > prints its object ID. Passing "heads/topic" as a separate argument > instead makes rev-parse echo "--glob" and try to resolve "heads/topic" > on its own. rev-list already accepts both forms. > Consume the next argument as the pattern, even if it looks like an > option. As in rev-list, a bare "--" still separates revisions from > paths, so report a missing pattern if it immediately follows --glob. > > Turn the two corresponding known failures in t6018 into expected > successes and exercise the missing-pattern diagnostic. Okay, so we have tests documenting this as a failure, which is a good indicator that it's something we may want to fix. There's two questions though coming to my mind: - Does it have any downsides to accept this pattern now? Like, does it for example introduce inconsistencies with how we parse other parameters? - Does the change have any upsides? Your patch kind of hints at the fact that this improves consistency with git-rev-list(1). But if we discover downsides while answering the first question we should weigh whether upsides overweight downsides. - The conversion is rather easy, so why did somebody bother to add a failing test instead of fixing the issue right away? Is there more to history here than the `test_expect_failure` indicates? Ideally, those questions should be discussed as part of the commit message to allow the reviewer to form an opinion on whether they think the change makes sense. > diff --git a/Documentation/git-rev-parse.adoc b/Documentation/git-rev-parse.adoc > index 9103d54d53..1181ce3b08 100644 > --- a/Documentation/git-rev-parse.adoc > +++ b/Documentation/git-rev-parse.adoc > @@ -201,6 +201,7 @@ shown. If the pattern does not contain a globbing > character (`?`, > `*`, or `[`), it is turned into a prefix match by appending `/*`. > > --glob=:: > +--glob :: > Show all refs matching the shell glob pattern `pattern`. If > the pattern does not start with `refs/`, this is automatically > prepended. If the pattern does not contain a globbing This change is quite uncustomary, to the best of my knowledge we always have the "=" there. > diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c > index 25a1e05714..56cc49c0f3 100644 > --- a/builtin/rev-parse.c > +++ b/builtin/rev-parse.c > @@ -969,7 +969,12 @@ int cmd_rev_parse(int argc, > handle_ref_opt(arg, "refs/tags/"); > continue; > } > - if (skip_prefix(arg, "--glob=", &arg)) { > + if (opt_with_value(arg, "--glob", &arg)) { > + if (!arg) { > + arg = argv[++i]; > + if (!arg || !strcmp(arg, "--")) > + die(_("--glob requires an argument")); > + } > handle_ref_opt(arg, NULL); > continue; > } None of the other options handle the argument with both " " and "=", as far as I can see. So yes, we align this with how git-rev-list(1) works. But at the same time we now make this option the only outlier in how git-rev-parse(1) works. So from my point of view this fix is too simplistic in its current form, as I'd like to retain consistency inside git-rev-parse(1), too. And honestly, the correct way to do that is to convert the command to use our parse-options subsystem to parse its parameters, as that would now align its option handling how all our other commands handle them. That's a much bigger change, but I'm just not sure whether it really makes sense to do a small localized change and punt on the bigger issue. Thanks! Patrick