From: Johannes Schindelin <johannes.schindelin@xxxxxx> In 6e98de72c03 (sequencer (rebase -i): add support for the 'fixup' and 'squash' commands, 2017-01-02), this developer introduced a change of behavior by mistake: when encountering a `fixup!` commit (or multiple `fixup!` commits) without any `squash!` commit thrown in, the final `git commit` was invoked with `--cleanup=strip`. Prior to that commit, the commit command had been called without that `--cleanup` option. Since we explicitly read the original commit message from a file in that case, there is really no sense in forcing that clean-up. Reported-by: Vojtěch Knyttl <vojtech@xxxxxxx> Signed-off-by: Johannes Schindelin <johannes.schindelin@xxxxxx> --- Fix bug in interactive rebases where fixup! cleans up the commit message Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-818%2Fdscho%2Fautosquash-without-scissors-v1 Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-818/dscho/autosquash-without-scissors-v1 Pull-Request: https://github.com/gitgitgadget/git/pull/818 sequencer.c | 5 ++--- t/t3415-rebase-autosquash.sh | 8 ++++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sequencer.c b/sequencer.c index 8909a467700..749bddd7a1f 100644 --- a/sequencer.c +++ b/sequencer.c @@ -2001,10 +2001,9 @@ static int do_pick_commit(struct repository *r, flags |= AMEND_MSG; if (!final_fixup) msg_file = rebase_path_squash_msg(); - else if (file_exists(rebase_path_fixup_msg())) { - flags |= CLEANUP_MSG; + else if (file_exists(rebase_path_fixup_msg())) msg_file = rebase_path_fixup_msg(); - } else { + else { const char *dest = git_path_squash_msg(r); unlink(dest); if (copy_file(dest, rebase_path_squash_msg(), 0666)) diff --git a/t/t3415-rebase-autosquash.sh b/t/t3415-rebase-autosquash.sh index 7bab6000dc7..4c83c98b3fc 100755 --- a/t/t3415-rebase-autosquash.sh +++ b/t/t3415-rebase-autosquash.sh @@ -440,4 +440,12 @@ test_expect_success 'fixup a fixup' ' test XZWY = $(git show | tr -cd W-Z) ' +test_expect_success 'fixup does not clean up commit message' ' + oneline="#818" && + git commit --allow-empty -m "$oneline" && + git commit --fixup HEAD --allow-empty && + git rebase -ki --autosquash HEAD~2 && + test "$oneline" = "$(git show -s --format=%s)" +' + test_done base-commit: ba2aa15129e59f248d8cdd30404bc78b5178f61d -- gitgitgadget