From: Junio C Hamano <gitster@pobox•com>
To: Eric Sunshine <sunshine@sunshineco•com>
Cc: Sundararajan R <dyoucme@gmail•com>, Git List <git@vger•kernel.org>
Subject: Re: [PATCH 1/2] Adding - shorthand for @{-1} in RESET command
Date: Tue, 10 Mar 2015 10:43:57 -0700 [thread overview]
Message-ID: <xmqqbnk021eq.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <CAPig+cRAB-LQctj6UOKUXps-MEh2C_EbSp_3=wfgxtWx6xCbhw@mail.gmail.com> (Eric Sunshine's message of "Tue, 10 Mar 2015 02:54:52 -0400")
Eric Sunshine <sunshine@sunshineco•com> writes:
>> @@ -226,7 +233,14 @@ static void parse_args(struct pathspec *pathspec,
>> rev = *argv++;
>> } else {
>> /* Otherwise we treat this as a filename */
>> - verify_filename(prefix, argv[0], 1);
>> + if(file_named_minus) {
>> + die(_("ambiguous argument '-': both revision and filename\n"
>> + "Use ./- for file named -\n"
>> + "Use '--' to separate paths from revisions, like this:\n"
>> + "'git <command> [<revision>...] -- [<file>...]'"));
>
> This seems odd. If arguments following '--' are unconditionally
> treated as paths, why is it be necessary to tell the user to spell out
> file '-' as './-'? Shouldn't "git reset -- -" be sufficient?
I find that the presense of the if statement itself even odder.
- verify_filename() and verify_non_filename() are designed to check
that the string "-" given by the end-user is or is not a filename
on the filesystem. Why isn't this caller letting the callee do
the job it was designed to do and doing that itself instead?
- we know "-" aka "@{-1}" does not resolve to a committish at this
point, so it must be a filename. If "-" exists, then why should
the user even need to differenciate it as ./- (or with "-- -")?
After all, if there is no branch whose name is 'foo' and a file
'foo' exists on the filesystem, the user can say "git reset foo"
without disambiguation to reset that path, no?
prev parent reply other threads:[~2015-03-10 17:44 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-09 20:46 [PATCH 1/2] Adding - shorthand for @{-1} in RESET command Sundararajan R
2015-03-09 20:46 ` [PATCH 2/2] Added tests for git reset - Sundararajan R
2015-03-10 5:48 ` Torsten Bögershausen
2015-03-10 7:49 ` Eric Sunshine
2015-03-10 17:36 ` Junio C Hamano
2015-03-10 6:54 ` [PATCH 1/2] Adding - shorthand for @{-1} in RESET command Eric Sunshine
2015-03-10 17:43 ` Junio C Hamano [this message]
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=xmqqbnk021eq.fsf@gitster.dls.corp.google.com \
--to=gitster@pobox$(echo .)com \
--cc=dyoucme@gmail$(echo .)com \
--cc=git@vger$(echo .)kernel.org \
--cc=sunshine@sunshineco$(echo .)com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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