From: Patrick Steinhardt <ps@pks.im>
To: Ben Knoble <ben.knoble@gmail.com>
Cc: Meet Soni <meetsoni3017@gmail.com>,
git@vger.kernel.org, shejialuo@gmail.com
Subject: Re: [GSoC][PATCH] builtin/refs: add 'get' subcommand
Date: Wed, 24 Sep 2025 08:32:32 +0200 [thread overview]
Message-ID: <aNOQgLmVTZ0JRzOm@pks.im> (raw)
In-Reply-To: <ABB734D1-EAB4-429C-9A36-C00E114E4207@gmail.com>
On Tue, Sep 23, 2025 at 12:57:04PM -0400, Ben Knoble wrote:
> With apologies if I cover well-trodden ground, as I haven’t been closely following this effort.
>
> > Le 23 sept. 2025 à 06:47, Meet Soni <meetsoni3017@gmail.com> a écrit :
> >
> > While `git-rev-parse(1)` and `git-show-ref(1)` can be used to read
> > reference values, they have drawbacks for scripting and discoverability.
> > `rev-parse` performs DWIM expansion which is unpredictable for scripts,
>
> [snip]
>
> > To address this, introduce a new plumbing command, `git refs get <ref>`.
> > This new command provides three key advantages:
> >
> > - It requires an exact refname and does not perform expansion, making
> > it safer and more predictable for scripting.
>
> What are the disadvantages of rev-parse’s DWIMmery in scripts? I would
> think it makes handling user input easier (e.g., my custom script can
> take a local branch name without writing « refs/heads/ » on the
> command-line). OTOH, a script that wants to precisely identify a ref
> can do so already, no?
>
> Since rev-parse presumably won’t go away, it might be ok to have 2
> ways of parsing (one with magic and one without), but that might be
> back to the same boat of not having a unified interface 😅
>
> Perhaps later we can add a « --dwim » flag for looser parsing, giving
> scripteds flexibility but strictness by default?
I think having such a "--dwim" flag at a later point could be a good
idea, yeah.
Patrick
next prev parent reply other threads:[~2025-09-24 6:32 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-09-23 10:45 [GSoC][PATCH] builtin/refs: add 'get' subcommand Meet Soni
2025-09-23 16:57 ` Ben Knoble
2025-09-24 6:32 ` Patrick Steinhardt [this message]
2025-09-23 21:50 ` Junio C Hamano
2025-09-24 6:32 ` Patrick Steinhardt
2025-09-24 15:29 ` Ben Knoble
2025-09-24 17:11 ` Junio C Hamano
2025-09-25 6:25 ` Patrick Steinhardt
2025-09-25 18:08 ` D. Ben Knoble
2025-09-25 18:43 ` Junio C Hamano
2025-09-24 6:32 ` Patrick Steinhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aNOQgLmVTZ0JRzOm@pks.im \
--to=ps@pks.im \
--cc=ben.knoble@gmail.com \
--cc=git@vger.kernel.org \
--cc=meetsoni3017@gmail.com \
--cc=shejialuo@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).