Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhillip Wood <phillip.wood@dunelm.org.uk>2023-09-06 18:22:46 +0300
committerJunio C Hamano <gitster@pobox.com>2023-09-06 20:29:43 +0300
commit206a78d710853eaed97ab50ba336789e6b3499c7 (patch)
tree76d2d2872e13fce87b6bd5e530b57c31ff23683b /t/t3418-rebase-continue.sh
parent36ac861a305720c54f759da814647d5987beb10b (diff)
rebase -i: remove patch file after conflict resolution
When a rebase stops for the user to resolve conflicts it writes a patch for the conflicting commit to .git/rebase-merge/patch. This file has been written since the introduction of "git-rebase-interactive.sh" in 1b1dce4bae7 (Teach rebase an interactive mode, 2007-06-25). I assume the idea was to enable the user inspect the conflicting commit in the same way as they could for the patch based rebase. This file should be deleted when the rebase continues as if the rebase stops for a failed "exec" command or a "break" command it is confusing to the user if there is a stale patch lying around from an unrelated command. As the path is now used in two different places rebase_path_patch() is added and used to obtain the path for the patch. To construct the path write_patch() previously used get_dir() which returns different paths depending on whether we're rebasing or cherry-picking/reverting. As this function is only called when rebasing it is safe to use a hard coded string for the directory instead. An assertion is added to make sure we don't starting calling this function when cherry-picking in the future. Signed-off-by: Phillip Wood <phillip.wood@dunelm.org.uk> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t3418-rebase-continue.sh')
-rwxr-xr-xt/t3418-rebase-continue.sh18
1 files changed, 18 insertions, 0 deletions
diff --git a/t/t3418-rebase-continue.sh b/t/t3418-rebase-continue.sh
index 2d0789e554..261e7cd754 100755
--- a/t/t3418-rebase-continue.sh
+++ b/t/t3418-rebase-continue.sh
@@ -244,6 +244,24 @@ test_expect_success 'the todo command "break" works' '
test_path_is_file execed
'
+test_expect_success 'patch file is removed before break command' '
+ test_when_finished "git rebase --abort" &&
+ cat >todo <<-\EOF &&
+ pick commit-new-file-F2-on-topic-branch
+ break
+ EOF
+
+ (
+ set_replace_editor todo &&
+ test_must_fail git rebase -i --onto commit-new-file-F2 HEAD
+ ) &&
+ test_path_is_file .git/rebase-merge/patch &&
+ echo 22>F2 &&
+ git add F2 &&
+ git rebase --continue &&
+ test_path_is_missing .git/rebase-merge/patch
+'
+
test_expect_success '--reschedule-failed-exec' '
test_when_finished "git rebase --abort" &&
test_must_fail git rebase -x false --reschedule-failed-exec HEAD^ &&