diff options
author | Junio C Hamano <gitster@pobox.com> | 2018-09-24 10:30:45 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2018-09-24 10:30:45 -0700 |
commit | 87ae8a1a950da28a2f75570ecaecbc9cd439c64c (patch) | |
tree | af7f39996045d70dd099d95a4d09683d420df800 /sequencer.c | |
parent | 150f307afc13961b0322ad0e7205a7b193368586 (diff) | |
parent | 10d2f35436fb350c42bdb8396aee424a9bce44b5 (diff) | |
download | git-87ae8a1a950da28a2f75570ecaecbc9cd439c64c.tar.gz |
Merge branch 'js/rebase-i-autosquash-fix'
"git rebase -i" did not clear the state files correctly when a run
of "squash/fixup" is aborted and then the user manually amended the
commit instead, which has been corrected.
* js/rebase-i-autosquash-fix:
rebase -i: be careful to wrap up fixup/squash chains
rebase -i --autosquash: demonstrate a problem skipping the last squash
Diffstat (limited to 'sequencer.c')
-rw-r--r-- | sequencer.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c index 00cefd129e..0b14e20012 100644 --- a/sequencer.c +++ b/sequencer.c @@ -3611,9 +3611,20 @@ static int commit_staged_changes(struct replay_opts *opts, * the commit message and if there was a squash, let the user * edit it. */ - if (is_clean && oideq(&head, &to_amend) && - opts->current_fixup_count > 0 && - file_exists(rebase_path_stopped_sha())) { + if (!is_clean || !opts->current_fixup_count) + ; /* this is not the final fixup */ + else if (!oideq(&head, &to_amend) || + !file_exists(rebase_path_stopped_sha())) { + /* was a final fixup or squash done manually? */ + if (!is_fixup(peek_command(todo_list, 0))) { + unlink(rebase_path_fixup_msg()); + unlink(rebase_path_squash_msg()); + unlink(rebase_path_current_fixups()); + strbuf_reset(&opts->current_fixups); + opts->current_fixup_count = 0; + } + } else { + /* we are in a fixup/squash chain */ const char *p = opts->current_fixups.buf; int len = opts->current_fixups.len; |