summaryrefslogtreecommitdiff
path: root/sequencer.c
diff options
context:
space:
mode:
authorJohannes Schindelin <johannes.schindelin@gmx.de>2018-08-31 23:45:04 (GMT)
committerJunio C Hamano <gitster@pobox.com>2018-09-04 15:59:33 (GMT)
commit10d2f35436fb350c42bdb8396aee424a9bce44b5 (patch)
tree49b7fe2d5b85fe388a0689627e519329c68191c6 /sequencer.c
parent2f3eb68f10be8541b6ffdcbb16d996fd3c7a9e82 (diff)
downloadgit-10d2f35436fb350c42bdb8396aee424a9bce44b5.zip
git-10d2f35436fb350c42bdb8396aee424a9bce44b5.tar.gz
git-10d2f35436fb350c42bdb8396aee424a9bce44b5.tar.bz2
rebase -i: be careful to wrap up fixup/squash chains
When an interactive rebase was stopped at the end of a fixup/squash chain, the user might have edited the commit manually before continuing (with either `git rebase --skip` or `git rebase --continue`, it does not really matter which). We need to be very careful to wrap up the fixup/squash chain also in this scenario: otherwise the next fixup/squash chain would try to pick up where the previous one was left. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Diffstat (limited to 'sequencer.c')
-rw-r--r--sequencer.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/sequencer.c b/sequencer.c
index 4034c04..cccec6b 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -3438,9 +3438,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 && !oidcmp(&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 (oidcmp(&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;