From: Junio C Hamano <gitster@pobox.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org, Sebastian Schuberth <sschuberth@gmail.com>
Subject: Re: [PATCH v2 2/3] sequencer: make commit options more extensible
Date: Thu, 23 Mar 2017 18:01:00 -0700 [thread overview]
Message-ID: <xmqq7f3fa3oz.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <75e2c4fe839602af19811ed3e251eb583ff6c8ad.1490285210.git.johannes.schindelin@gmx.de> (Johannes Schindelin's message of "Thu, 23 Mar 2017 17:07:11 +0100 (CET)")
Johannes Schindelin <johannes.schindelin@gmx.de> writes:
> @@ -926,14 +930,14 @@ static void record_in_rewritten(struct object_id *oid,
> static int do_pick_commit(enum todo_command command, struct commit *commit,
> struct replay_opts *opts, int final_fixup)
> {
> - int edit = opts->edit, cleanup_commit_message = 0;
> - const char *msg_file = edit ? NULL : git_path_merge_msg();
> + unsigned int flags = opts->edit ? EDIT_MSG : 0, allow = 0;
> + const char *msg_file = opts->edit ? NULL : git_path_merge_msg();
> unsigned char head[20];
> struct commit *base, *next, *parent;
> const char *base_label, *next_label;
> struct commit_message msg = { NULL, NULL, NULL, NULL };
> struct strbuf msgbuf = STRBUF_INIT;
> - int res, unborn = 0, amend = 0, allow = 0;
> + int res, unborn = 0;
> ...
> @@ -1123,11 +1127,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
> if (allow < 0) {
> res = allow;
> goto leave;
> - }
> + } else if (allow)
> + flags |= ALLOW_EMPTY;
Making "flags" unsigned was a correct change, but this is now wrong,
as "allow" is made unsigned by accident. It still needs to receive
the return value from allow_empty() that can signal an error by
returning a negative value. It seems you did this deliberately (it
wasn't like "flags" and "allow" were on the same line both "int" and
the change to make "flags" unsigned accidentally made "allow" also
unsigned; "allow" was "int" and didn't have to move when "flags" was
introduced in the first place), but I failed to spot it because I
was only looking at s/int/unsigned/ on the line in the interdiff,
and missed that "allow" was on the same line. Compilers are better at
finding these bugs.
Perhaps something like this needs to be squashed in?
sequencer.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sequencer.c b/sequencer.c
index bc2fe48e65..6c423566e6 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -932,14 +932,14 @@ static void record_in_rewritten(struct object_id *oid,
static int do_pick_commit(enum todo_command command, struct commit *commit,
struct replay_opts *opts, int final_fixup)
{
- unsigned int flags = opts->edit ? EDIT_MSG : 0, allow = 0;
+ unsigned int flags = opts->edit ? EDIT_MSG : 0;
const char *msg_file = opts->edit ? NULL : git_path_merge_msg();
unsigned char head[20];
struct commit *base, *next, *parent;
const char *base_label, *next_label;
struct commit_message msg = { NULL, NULL, NULL, NULL };
struct strbuf msgbuf = STRBUF_INIT;
- int res, unborn = 0;
+ int allow, res, unborn = 0;
if (opts->no_commit) {
/*
--
2.12.1-432-gf364f02724
next prev parent reply other threads:[~2017-03-24 1:01 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-22 15:01 [PATCH 0/3] rebase -i (reword): call the commit-msg hook again Johannes Schindelin
2017-03-22 15:01 ` [PATCH 1/3] t7504: document regression: reword no longer calls commit-msg Johannes Schindelin
2017-03-22 15:18 ` Sebastian Schuberth
2017-03-22 16:09 ` Johannes Schindelin
2017-03-22 18:15 ` Junio C Hamano
2017-03-23 14:43 ` Johannes Schindelin
2017-03-23 14:55 ` Sebastian Schuberth
2017-03-23 15:52 ` Johannes Schindelin
2017-03-22 18:12 ` Junio C Hamano
2017-03-23 14:41 ` Johannes Schindelin
2017-03-22 15:01 ` [PATCH 2/3] sequencer: make commit options more extensible Johannes Schindelin
2017-03-22 18:21 ` Junio C Hamano
2017-03-23 14:39 ` Johannes Schindelin
2017-03-23 16:04 ` Junio C Hamano
2017-03-22 15:02 ` [PATCH 3/3] sequencer: allow the commit-msg hooks to run during a `reword` Johannes Schindelin
2017-03-22 18:43 ` Junio C Hamano
2017-03-23 15:49 ` Johannes Schindelin
2017-03-23 16:07 ` [PATCH v2 0/3] rebase -i (reword): call the commit-msg hook again Johannes Schindelin
2017-03-23 16:07 ` [PATCH v2 1/3] t7504: document regression: reword no longer calls commit-msg Johannes Schindelin
2017-03-23 16:07 ` [PATCH v2 2/3] sequencer: make commit options more extensible Johannes Schindelin
2017-03-24 1:01 ` Junio C Hamano [this message]
2017-03-25 0:01 ` Johannes Schindelin
2017-03-27 0:55 ` Junio C Hamano
2017-03-27 21:03 ` Junio C Hamano
2017-03-29 12:49 ` Johannes Schindelin
2017-03-23 16:07 ` [PATCH v2 3/3] sequencer: allow the commit-msg hooks to run during a `reword` Johannes Schindelin
2017-03-23 16:51 ` Junio C Hamano
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=xmqq7f3fa3oz.fsf@gitster.mtv.corp.google.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=johannes.schindelin@gmx.de \
--cc=sschuberth@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.