Skip to content

Commit 185b0d0

Browse files
committed
merge: recursive uses larger conflict markers
Git uses longer conflict markers in the recursive merge base - two more than the default (thus, 9 character long conflict markers). This allows users to tell the difference between the recursive merge conflicts and conflicts between the ours and theirs branches. This was introduced in git d694a17986a28bbc19e2a6c32404ca24572e400f. Update our tests to expect this as well.
1 parent b8e9467 commit 185b0d0

File tree

4 files changed

+9
-8
lines changed

4 files changed

+9
-8
lines changed

src/merge.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2075,6 +2075,7 @@ int git_merge__iterators(
20752075
file_opts.our_label = "Temporary merge branch 1";
20762076
file_opts.their_label = "Temporary merge branch 2";
20772077
file_opts.flags |= GIT_MERGE_FILE_FAVOR__CONFLICTED;
2078+
file_opts.marker_size = GIT_MERGE_CONFLICT_MARKER_SIZE + 2;
20782079
}
20792080

20802081
diff_list = git_merge_diff_list__alloc(repo);

tests/merge/conflict_data.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,13 @@
7676
"<<<<<<< HEAD\n" \
7777
"put into a pot three quarts of water, three onions cut small, one\n" \
7878
"||||||| merged common ancestors\n" \
79-
"<<<<<<< Temporary merge branch 1\n" \
79+
"<<<<<<<<< Temporary merge branch 1\n" \
8080
"Put into a pot three quarts of water, THREE ONIONS CUT SMALL, one\n" \
81-
"||||||| merged common ancestors\n" \
81+
"||||||||| merged common ancestors\n" \
8282
"Put into a pot three quarts of water, three onions cut small, one\n" \
83-
"=======\n" \
83+
"=========\n" \
8484
"PUT INTO A POT three quarts of water, three onions cut small, one\n" \
85-
">>>>>>> Temporary merge branch 2\n" \
85+
">>>>>>>>> Temporary merge branch 2\n" \
8686
"=======\n" \
8787
"Put Into A Pot Three Quarts of Water, Three Onions Cut Small, One\n" \
8888
">>>>>>> branchH-2\n" \

tests/merge/trees/recursive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ void test_merge_trees_recursive__conflicting_merge_base(void)
312312
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
313313
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
314314
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
315-
{ 0100644, "3a66812fed1e03ea4a6a7ee28d8a57aec1ca6537", 1, "veal.txt" },
315+
{ 0100644, "ba5714aa3d5aebfd8e19d19cb1ddcfda63426a44", 1, "veal.txt" },
316316
{ 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" },
317317
{ 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" },
318318
};
@@ -339,7 +339,7 @@ void test_merge_trees_recursive__conflicting_merge_base_with_diff3(void)
339339
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
340340
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
341341
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
342-
{ 0100644, "cd17a91513f3aee9e44114d1ede67932dd41d2fc", 1, "veal.txt" },
342+
{ 0100644, "adb1bf17d112a0b4ecbd4e75bef6db3335d8ddcf", 1, "veal.txt" },
343343
{ 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" },
344344
{ 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" },
345345
};

tests/merge/workdir/recursive.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ void test_merge_workdir_recursive__writes_conflict_with_virtual_base(void)
4444
cl_git_pass(git_futils_readbuffer(&conflicting_buf, "merge-recursive/veal.txt"));
4545

4646
cl_assert_equal_s(CONFLICTING_RECURSIVE_F1_TO_F2, conflicting_buf.ptr);
47-
47+
4848
git_index_free(index);
4949
git_buf_free(&conflicting_buf);
5050
}
@@ -62,7 +62,7 @@ void test_merge_workdir_recursive__conflicting_merge_base_with_diff3(void)
6262
{ 0100644, "4b7c5650008b2e747fe1809eeb5a1dde0e80850a", 0, "bouilli.txt" },
6363
{ 0100644, "c4e6cca3ec6ae0148ed231f97257df8c311e015f", 0, "gravy.txt" },
6464
{ 0100644, "68af1fc7407fd9addf1701a87eb1c95c7494c598", 0, "oyster.txt" },
65-
{ 0100644, "cd17a91513f3aee9e44114d1ede67932dd41d2fc", 1, "veal.txt" },
65+
{ 0100644, "adb1bf17d112a0b4ecbd4e75bef6db3335d8ddcf", 1, "veal.txt" },
6666
{ 0100644, "d604c75019c282144bdbbf3fd3462ba74b240efc", 2, "veal.txt" },
6767
{ 0100644, "37a5054a9f9b4628e3924c5cb8f2147c6e2a3efc", 3, "veal.txt" },
6868
};

0 commit comments

Comments
 (0)