From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Elijah Newren <newren@gmail.com>
Cc: Eric Sunshine <sunshine@sunshineco.com>, ch <cr@onlinehome.de>,
git@vger.kernel.org, gitster@pobox.com
Subject: Re: [PATCH v2] sequencer: do not squash 'reword' commits when we hit conflicts
Date: Sun, 17 Jun 2018 20:46:33 +0200 (DST) [thread overview]
Message-ID: <nycvar.QRO.7.76.6.1806172046090.77@tvgsbejvaqbjf.bet> (raw)
In-Reply-To: <20180617053703.19856-1-newren@gmail.com>
Hi Elijah,
On Sat, 16 Jun 2018, Elijah Newren wrote:
> Ever since commit 18633e1a22 ("rebase -i: use the rebase--helper builtin",
> 2017-02-09), when a commit marked as 'reword' in an interactive rebase
> has conflicts and fails to apply, when the rebase is resumed that commit
> will be squashed into its parent with its commit message taken.
>
> The issue can be understood better by looking at commit 56dc3ab04b
> ("sequencer (rebase -i): implement the 'edit' command", 2017-01-02), which
> introduced error_with_patch() for the edit command. For the edit command,
> it needs to stop the rebase whether or not the patch applies cleanly. If
> the patch does apply cleanly, then when it resumes it knows it needs to
> amend all changes into the previous commit. If it does not apply cleanly,
> then the changes should not be amended. Thus, it passes !res (success of
> applying the 'edit' commit) to error_with_patch() for the to_amend flag.
>
> The problematic line of code actually came from commit 04efc8b57c
> ("sequencer (rebase -i): implement the 'reword' command", 2017-01-02).
> Note that to get to this point in the code:
> * !!res (i.e. patch application failed)
> * item->command < TODO_SQUASH
> * item->command != TODO_EDIT
> * !is_fixup(item->command) [i.e. not squash or fixup]
> So that means this can only be a failed patch application that is either a
> pick, revert, or reword. For any of those cases we want a new commit, so
> we should not set the to_amend flag.
>
> Signed-off-by: Elijah Newren <newren@gmail.com>
> ---
> Differences since v1 (Thanks to Eric Sunshine for the suggestions):
> * Add test_when_finished "reset_rebase" calls
> * Remove unnecessary word from description of test
>
> sequencer.c | 2 +-
> t/t3423-rebase-reword.sh | 48 ++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 49 insertions(+), 1 deletion(-)
> create mode 100755 t/t3423-rebase-reword.sh
>
> diff --git a/sequencer.c b/sequencer.c
> index cca968043e..9e6d1ee368 100644
> --- a/sequencer.c
> +++ b/sequencer.c
> @@ -3217,7 +3217,7 @@ static int pick_commits(struct todo_list *todo_list, struct replay_opts *opts)
> } else if (res && is_rebase_i(opts) && item->commit)
> return res | error_with_patch(item->commit,
> item->arg, item->arg_len, opts, res,
> - item->command == TODO_REWORD);
> + 0);
I agree that this is the correct bug fix. ACK!
Thanks,
Dscho
prev parent reply other threads:[~2018-06-17 18:52 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-11 16:06 [BUG] git-rebase: reword squashes commits in case of merge-conflicts ch
2018-06-12 10:08 ` Jeff King
2018-06-15 14:35 ` ch
2018-06-16 16:08 ` Elijah Newren
2018-06-17 3:36 ` Eric Sunshine
2018-06-17 5:37 ` [PATCH v2] sequencer: do not squash 'reword' commits when we hit conflicts Elijah Newren
2018-06-17 15:04 ` Phillip Wood
2018-06-17 19:28 ` Johannes Schindelin
2018-06-18 10:20 ` Phillip Wood
2018-06-18 15:42 ` Junio C Hamano
2018-06-18 21:42 ` Johannes Schindelin
2018-06-19 10:00 ` [PATCH v2] sequencer: do not squash 'reword' commits when wehit conflicts Phillip Wood
2018-06-19 12:46 ` [PATCH v3] sequencer: do not squash 'reword' commits when we hit conflicts Phillip Wood
2018-06-19 14:29 ` Elijah Newren
2018-06-19 16:59 ` Junio C Hamano
2018-08-23 10:09 ` [PATCH] t/lib-rebase.sh: support explicit 'pick' commands in 'fake_editor.sh' SZEDER Gábor
2018-08-23 16:20 ` Junio C Hamano
2018-08-23 20:53 ` Johannes Schindelin
2018-06-17 18:46 ` Johannes Schindelin [this message]
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=nycvar.QRO.7.76.6.1806172046090.77@tvgsbejvaqbjf.bet \
--to=johannes.schindelin@gmx.de \
--cc=cr@onlinehome.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
--cc=sunshine@sunshineco.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).