git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Fwd: Possible bug report: `git commit -ammend`
       [not found] <CAMyx446B1U30RL9X7vOrY-u7fQ_cEqRJxn_M8Wn8PuOJhdO-1Q@mail.gmail.com>
@ 2013-11-15 15:44 ` rhys evans
  2013-11-15 15:54   ` Matthieu Moy
  0 siblings, 1 reply; 4+ messages in thread
From: rhys evans @ 2013-11-15 15:44 UTC (permalink / raw)
  To: git

I ran `git commit -ammend` on a repo where 1 out of 3 files changed
were staged for commit.

I would've expected an error to be thrown due to the double typo but
instead it committed all 3 files with the message 'mend'.

So it looks like it interpreted it as `git commit -a -m 'mend'`.

I'm running git 1.8.3.4 using iTerm 1.0.0 on OSX 10.9.

-- 

------------------------------
This email was sent by a company owned by Pearson plc, registered office at 
80 Strand, London WC2R 0RL.  Registered in England and Wales with company 
number 53723.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: Possible bug report: `git commit -ammend`
  2013-11-15 15:44 ` Fwd: Possible bug report: `git commit -ammend` rhys evans
@ 2013-11-15 15:54   ` Matthieu Moy
  2013-11-16  3:28     ` Duy Nguyen
  0 siblings, 1 reply; 4+ messages in thread
From: Matthieu Moy @ 2013-11-15 15:54 UTC (permalink / raw)
  To: rhys evans; +Cc: git

rhys evans <rhys.evans@ft.com> writes:

> I ran `git commit -ammend` on a repo where 1 out of 3 files changed
> were staged for commit.
>
> I would've expected an error to be thrown due to the double typo but
> instead it committed all 3 files with the message 'mend'.
>
> So it looks like it interpreted it as `git commit -a -m 'mend'`.

Yes. This is a rather widespread convention (e.g. rm -fr == rm -r -f).
Git does a special-case for -amend to avoid confusion:

  $ git commit -amend
  error: did you mean `--amend` (with two dashes ?)

But it did not special-case the double-typo.

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: Possible bug report: `git commit -ammend`
  2013-11-15 15:54   ` Matthieu Moy
@ 2013-11-16  3:28     ` Duy Nguyen
  2013-11-16  4:02       ` Jeff King
  0 siblings, 1 reply; 4+ messages in thread
From: Duy Nguyen @ 2013-11-16  3:28 UTC (permalink / raw)
  To: Matthieu Moy; +Cc: rhys evans, Git Mailing List

On Fri, Nov 15, 2013 at 10:54 PM, Matthieu Moy
<Matthieu.Moy@grenoble-inp.fr> wrote:
> rhys evans <rhys.evans@ft.com> writes:
>
>> I ran `git commit -ammend` on a repo where 1 out of 3 files changed
>> were staged for commit.
>>
>> I would've expected an error to be thrown due to the double typo but
>> instead it committed all 3 files with the message 'mend'.
>>
>> So it looks like it interpreted it as `git commit -a -m 'mend'`.
>
> Yes. This is a rather widespread convention (e.g. rm -fr == rm -r -f).
> Git does a special-case for -amend to avoid confusion:
>
>   $ git commit -amend
>   error: did you mean `--amend` (with two dashes ?)
>
> But it did not special-case the double-typo.

"-m" taking a string without a space or '=' increases the risk of this
typo. If it does require '=' or ' ' after -m then -ammend is more
likely to be rejected. Anybody know why we should support -mabc,
besides convenient?
-- 
Duy

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Fwd: Possible bug report: `git commit -ammend`
  2013-11-16  3:28     ` Duy Nguyen
@ 2013-11-16  4:02       ` Jeff King
  0 siblings, 0 replies; 4+ messages in thread
From: Jeff King @ 2013-11-16  4:02 UTC (permalink / raw)
  To: Duy Nguyen; +Cc: Matthieu Moy, rhys evans, Git Mailing List

On Sat, Nov 16, 2013 at 10:28:36AM +0700, Duy Nguyen wrote:

> > Yes. This is a rather widespread convention (e.g. rm -fr == rm -r -f).
> > Git does a special-case for -amend to avoid confusion:
> >
> >   $ git commit -amend
> >   error: did you mean `--amend` (with two dashes ?)
> >
> > But it did not special-case the double-typo.
> 
> "-m" taking a string without a space or '=' increases the risk of this
> typo. If it does require '=' or ' ' after -m then -ammend is more
> likely to be rejected. Anybody know why we should support -mabc,
> besides convenient?

For flags with optional arguments, "-m abc" would not work (we do not
know if "abc" is the argument or the next flag). An example of such a
flag is "git status -uall".

We could disallow it for mandatory options, but that would create an
inconsistency in the option parsing.

Other than that, I think it is mostly convenience and compatibility with
other option-parsing systems.

-Peff

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-11-16  4:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <CAMyx446B1U30RL9X7vOrY-u7fQ_cEqRJxn_M8Wn8PuOJhdO-1Q@mail.gmail.com>
2013-11-15 15:44 ` Fwd: Possible bug report: `git commit -ammend` rhys evans
2013-11-15 15:54   ` Matthieu Moy
2013-11-16  3:28     ` Duy Nguyen
2013-11-16  4:02       ` Jeff King

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).