git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Bug: Revert with -m 0 says no -m was given
@ 2017-03-23 17:17 Ulrik Sverdrup
  2017-03-23 18:15 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ulrik Sverdrup @ 2017-03-23 17:17 UTC (permalink / raw)
  To: git

Hi,

Git produces a misleading error when you tell it `git revert -m 0`. The
user error is that the parent should be greater than zero, but git
doesn't help you. (I forgot that the first parent is 1 and not 0.)

$ git revert -m 0 abc
error: commit abc... is a merge but no -m option was given.
fatal: revert failed

Git already handles too large m correctly:

$ git revert -m 3 abc
error: commit abc... does not have parent 3
fatal: revert failed

-Ulrik

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

* Re: Bug: Revert with -m 0 says no -m was given
  2017-03-23 17:17 Bug: Revert with -m 0 says no -m was given Ulrik Sverdrup
@ 2017-03-23 18:15 ` Junio C Hamano
  2017-03-23 20:39   ` Ævar Arnfjörð Bjarmason
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2017-03-23 18:15 UTC (permalink / raw)
  To: Ulrik Sverdrup; +Cc: git

Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:

> Git produces a misleading error when you tell it `git revert -m 0`.

Thanks.  

I think this is the same issue as the one with 'cherry-pick' that
was reported earlier.  We have a fix in the 'master' branch already;
please try it out.




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

* Re: Bug: Revert with -m 0 says no -m was given
  2017-03-23 18:15 ` Junio C Hamano
@ 2017-03-23 20:39   ` Ævar Arnfjörð Bjarmason
  2017-03-23 21:38     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2017-03-23 20:39 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Ulrik Sverdrup, Git Mailing List

On Thu, Mar 23, 2017 at 7:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:
>
>> Git produces a misleading error when you tell it `git revert -m 0`.
>
> Thanks.
>
> I think this is the same issue as the one with 'cherry-pick' that
> was reported earlier.  We have a fix in the 'master' branch already;
> please try it out.

Specifically, in master:

$ ./git revert afd6726309
error: commit afd6726309f57f532b4b989a75c1392359c611cc is a merge but
no -m option was given.
fatal: revert failed
$ ./git revert -m 0 afd6726309
error: option `mainline' expects a number greater than zero

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

* Re: Bug: Revert with -m 0 says no -m was given
  2017-03-23 20:39   ` Ævar Arnfjörð Bjarmason
@ 2017-03-23 21:38     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2017-03-23 21:38 UTC (permalink / raw)
  To: Ævar Arnfjörð Bjarmason; +Cc: Ulrik Sverdrup, Git Mailing List

Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:

> On Thu, Mar 23, 2017 at 7:15 PM, Junio C Hamano <gitster@pobox.com> wrote:
>> Ulrik Sverdrup <ulrik.sverdrup@gmail.com> writes:
>>
>>> Git produces a misleading error when you tell it `git revert -m 0`.
>>
>> Thanks.
>>
>> I think this is the same issue as the one with 'cherry-pick' that
>> was reported earlier.  We have a fix in the 'master' branch already;
>> please try it out.
>
> Specifically, in master:
>
> $ ./git revert afd6726309
> error: commit afd6726309f57f532b4b989a75c1392359c611cc is a merge but
> no -m option was given.
> fatal: revert failed
> $ ./git revert -m 0 afd6726309
> error: option `mainline' expects a number greater than zero

Yes, exactly.

Thanks.

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

end of thread, other threads:[~2017-03-23 21:39 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-23 17:17 Bug: Revert with -m 0 says no -m was given Ulrik Sverdrup
2017-03-23 18:15 ` Junio C Hamano
2017-03-23 20:39   ` Ævar Arnfjörð Bjarmason
2017-03-23 21:38     ` Junio C Hamano

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