Thread (1 message) 1 message, 1 author, 2022-05-19

Re: [PATCH 2/2] merge: make restore_state() do as its name says

From: Junio C Hamano <hidden>
Date: 2022-05-19 18:32:42

Junio C Hamano [off-list ref] writes:
quoted
+test_expect_success 'set up custom strategy' '
+	test_commit --no-tag "Initial" base base &&
+git show-ref &&
+
+	for b in branch1 branch2 branch3
+	do
+		git checkout -b $b main &&
+		test_commit --no-tag "Change on $b" base $b
+	done &&
+
+	git checkout branch1 &&
Here, perhaps we can make two additional test cases, that try with
local change that (1) overlaps with the changes branch2 and branch3
bring in and that (2) does not overlap.  I am worried about the case
(2) losing the local change due to the call to reset_hard().
We do not need a new test to demonstrate the breakage in the
proposed patch, I think.  Here is one place I found that we already
test that merging in a dirty working tree fails.  We only need to
make sure that we do so without losing local changes.

 t/t6424-merge-unrelated-index-changes.sh | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git c/t/t6424-merge-unrelated-index-changes.sh w/t/t6424-merge-unrelated-index-changes.sh
index 89dd544f38..88e0b541a0 100755
--- c/t/t6424-merge-unrelated-index-changes.sh
+++ w/t/t6424-merge-unrelated-index-changes.sh
@@ -171,7 +171,8 @@ test_expect_success 'octopus, unrelated file touched' '
 	touch random_file && git add random_file &&
 
 	test_must_fail git merge C^0 D^0 &&
-	test_path_is_missing .git/MERGE_HEAD
+	test_path_is_missing .git/MERGE_HEAD &&
+	test_path_exists random_file
 '
 
 test_expect_success 'octopus, related file removed' '
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help