Skip to contentSkip to conversation

Bug: Revert with -m 0 says no -m was given

DISCUSSION Ulrik Sverdrup 3 participants 4 messages Mar 23, 2017

lore
Share & tools
lore
#0 lore raw

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

#1 lore raw
Quoted 1 line · Ulrik Sverdrup

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.

#2 lore raw
Quoted 9 lines · Junio C Hamano
Quoted 1 line · Ulrik Sverdrup

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
#3 lore raw
Quoted 11 lines · Ævar Arnfjörð Bjarmason
Quoted 9 lines · Junio C Hamano
Quoted 1 line · Ulrik Sverdrup

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.

Quoted 8 lines

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.