* [BUG] git commit --allow-empty-message -m '' fails
@ 2015-05-01 23:31 Josh Hagins
2015-05-02 1:06 ` Jeff King
0 siblings, 1 reply; 4+ messages in thread
From: Josh Hagins @ 2015-05-01 23:31 UTC (permalink / raw)
To: git
When passed the `--allow-empty-message` flag with no `-m`, `git
commit` will open the editor and allow you to exit with an empty
message, as expected.
However, when passed `-m ''` in addition to `--allow-empty-message`,
the commit fails. Example below:
$ git commit -a --allow-empty-message -m ''
error: switch `m' requires a value
usage: git commit [<options>] [--] <pathspec>...
...
Shouldn't the `-m` switch know whether the `--allow-empty-message`
flag has been passed?
Thanks,
Josh
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [BUG] git commit --allow-empty-message -m '' fails
2015-05-01 23:31 [BUG] git commit --allow-empty-message -m '' fails Josh Hagins
@ 2015-05-02 1:06 ` Jeff King
[not found] ` <CANuW5x1jeAY4KrOQez30mNp864abaYFyDDrdfM=NHCSosTSzkQ@mail.gmail.com>
0 siblings, 1 reply; 4+ messages in thread
From: Jeff King @ 2015-05-02 1:06 UTC (permalink / raw)
To: Josh Hagins; +Cc: git
On Fri, May 01, 2015 at 07:31:08PM -0400, Josh Hagins wrote:
> When passed the `--allow-empty-message` flag with no `-m`, `git
> commit` will open the editor and allow you to exit with an empty
> message, as expected.
>
> However, when passed `-m ''` in addition to `--allow-empty-message`,
> the commit fails. Example below:
>
> $ git commit -a --allow-empty-message -m ''
> error: switch `m' requires a value
> usage: git commit [<options>] [--] <pathspec>...
> ...
>
> Shouldn't the `-m` switch know whether the `--allow-empty-message`
> flag has been passed?
It should. It works here for me:
$ git commit --allow-empty --allow-empty-message -m ''
[master 2957ea1]
The message you're seeing comes from the option-parser, which thinks
there isn't any argument to `-m` at all. I can get the same result like:
$ git commit --allow-empty --allow-empty-message -m
error: switch `m' requires a value
...
Are you running the command inside another bit of shell script that
might be eating the empty argument (e.g., eval-ing it inside of another
set of single quotes or something like that)?
-Peff
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-05-02 2:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-01 23:31 [BUG] git commit --allow-empty-message -m '' fails Josh Hagins
2015-05-02 1:06 ` Jeff King
[not found] ` <CANuW5x1jeAY4KrOQez30mNp864abaYFyDDrdfM=NHCSosTSzkQ@mail.gmail.com>
2015-05-02 2:29 ` Jeff King
2015-05-02 2:44 ` Josh Hagins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox