From: Jeff King <peff@peff.net>
To: Josh Hagins <hagins.josh@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [BUG] git commit --allow-empty-message -m '' fails
Date: Fri, 1 May 2015 21:06:06 -0400 [thread overview]
Message-ID: <20150502010605.GA5634@peff.net> (raw)
In-Reply-To: <CANuW5x0eKVAToG76rJr6+n-Fdg7E5c8mHb8NvnQUT2PBzxjjPQ@mail.gmail.com>
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
next prev parent reply other threads:[~2015-05-02 1:06 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-01 23:31 [BUG] git commit --allow-empty-message -m '' fails Josh Hagins
2015-05-02 1:06 ` Jeff King [this message]
[not found] ` <CANuW5x1jeAY4KrOQez30mNp864abaYFyDDrdfM=NHCSosTSzkQ@mail.gmail.com>
2015-05-02 2:29 ` Jeff King
2015-05-02 2:44 ` Josh Hagins
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20150502010605.GA5634@peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=hagins.josh@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.