Re: [BUG] git commit --allow-empty-message -m '' fails
- From
Jeff King <peff@peff.net>
- Date
- May 2, 2015, 01:06 UTC
- Message-ID
- <20150502010605.GA5634@peff.net>
- In-Reply-To
- <CANuW5x0eKVAToG76rJr6+n-Fdg7E5c8mHb8NvnQUT2PBzxjjPQ@mail.gmail.com>
On Fri, May 01, 2015 at 07:31:08PM -0400, Josh Hagins wrote:
Show 14 quoted lines
> 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