From: Antoine Pelisse <apelisse@gmail.com>
To: Ramkumar Ramachandra <artagnon@gmail.com>
Cc: "Mislav Marohnić" <mislav.marohnic@gmail.com>,
"Brandon Casey" <drafnel@gmail.com>,
"Jonathan Nieder" <jrnieder@gmail.com>,
"Git List" <git@vger.kernel.org>
Subject: Re: [PATCH v2] commit: don't use-editor when allow-empty-message
Date: Mon, 27 May 2013 16:53:01 +0200 [thread overview]
Message-ID: <CALWbr2zW7BKwkNd5gU8vyE8KvMkzUMf1zTOr5X0cxsO7_4KA=Q@mail.gmail.com> (raw)
In-Reply-To: <1369664419-16440-1-git-send-email-artagnon@gmail.com>
So now we have two fixes for the same issue, don't we ?
You probably missed $gmane/225534.
On Mon, May 27, 2013 at 4:20 PM, Ramkumar Ramachandra
<artagnon@gmail.com> wrote:
> Commit a24a41e (git-commit: only append a newline to -m mesg if
> necessary, 2013-02-18) introduced a regression: when
> --allow-empty-message is used and an empty message is explicitly
> specified with -m "", git commit still launches $EDITOR unnecessarily.
> The commit (correctly) fixes opt_parse_m() to not fill in two newlines
> into the message buffer unconditionally. The real problem is that
> launching $EDITOR only depends on use_editor and whether message is
> empty. Fix the problem by setting explicit_message in the codepath
> where an explicit string is passed via -m, and then checking it before
> launching $EDITOR.
>
> Reported-by: Mislav Marohnić <mislav.marohnic@gmail.com>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
> Works?
>
> builtin/commit.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/builtin/commit.c b/builtin/commit.c
> index d2f30d9..7d72ba7 100644
> --- a/builtin/commit.c
> +++ b/builtin/commit.c
> @@ -108,6 +108,7 @@ static const char *cleanup_arg;
> static enum commit_whence whence;
> static int use_editor = 1, include_status = 1;
> static int show_ignored_in_status;
> +static int explicit_message = 0;
> static const char *only_include_assumed;
> static struct strbuf message = STRBUF_INIT;
>
> @@ -128,6 +129,7 @@ static int opt_parse_m(const struct option *opt, const char *arg, int unset)
> strbuf_addch(buf, '\n');
> strbuf_addstr(buf, arg);
> strbuf_complete_line(buf);
> + explicit_message = 1;
> }
> return 0;
> }
> @@ -824,7 +826,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
> git_path(commit_editmsg), hook_arg1, hook_arg2, NULL))
> return 0;
>
> - if (use_editor) {
> + if (use_editor && !explicit_message) {
> char index[PATH_MAX];
> const char *env[2] = { NULL };
> env[0] = index;
> --
> 1.8.3.1.g33669de.dirty
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2013-05-27 14:53 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-25 19:12 Commit with an empty message broken since v1.8.2.1 Mislav Marohnić
2013-05-25 21:43 ` [PATCH] commit: don't start editor if empty message is given with -m René Scharfe
2013-05-27 14:03 ` [PATCH] commit: don't use-editor when allow-empty-message Ramkumar Ramachandra
2013-05-27 14:07 ` Ramkumar Ramachandra
2013-05-27 14:20 ` [PATCH v2] " Ramkumar Ramachandra
2013-05-27 14:53 ` Antoine Pelisse [this message]
2013-05-27 17:57 ` Ramkumar Ramachandra
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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CALWbr2zW7BKwkNd5gU8vyE8KvMkzUMf1zTOr5X0cxsO7_4KA=Q@mail.gmail.com' \
--to=apelisse@gmail.com \
--cc=artagnon@gmail.com \
--cc=drafnel@gmail.com \
--cc=git@vger.kernel.org \
--cc=jrnieder@gmail.com \
--cc=mislav.marohnic@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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 read-only IMAP folder(s) and NNTP newsgroup(s).