Skip to content

Commit c0297d4

Browse files
committed
merge: comment conflicts lines in MERGE_MSG
git has started adding comment markers to its conflict lines in MERGE_MSG. Match that behavior.
1 parent 46885ac commit c0297d4

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

src/merge.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3126,7 +3126,7 @@ int git_merge__append_conflicts_to_merge_msg(
31263126
(error = git_filebuf_open(&file, file_path.ptr, GIT_FILEBUF_APPEND, GIT_MERGE_FILE_MODE)) < 0)
31273127
goto cleanup;
31283128

3129-
git_filebuf_printf(&file, "\nConflicts:\n");
3129+
git_filebuf_printf(&file, "\n#Conflicts:\n");
31303130

31313131
for (i = 0; i < git_index_entrycount(index); i++) {
31323132
const git_index_entry *e = git_index_get_byindex(index, i);
@@ -3135,7 +3135,7 @@ int git_merge__append_conflicts_to_merge_msg(
31353135
continue;
31363136

31373137
if (last == NULL || strcmp(e->path, last) != 0)
3138-
git_filebuf_printf(&file, "\t%s\n", e->path);
3138+
git_filebuf_printf(&file, "#\t%s\n", e->path);
31393139

31403140
last = e->path;
31413141
}

tests/cherrypick/workdir.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,9 @@ void test_cherrypick_workdir__conflicts(void)
170170
cl_assert(strcmp(git_str_cstr(&mergemsg_buf),
171171
"Change all files\n" \
172172
"\n" \
173-
"Conflicts:\n" \
174-
"\tfile2.txt\n" \
175-
"\tfile3.txt\n") == 0);
173+
"#Conflicts:\n" \
174+
"#\tfile2.txt\n" \
175+
"#\tfile3.txt\n") == 0);
176176

177177
cl_git_pass(git_futils_readbuffer(&conflicting_buf,
178178
TEST_REPO_PATH "/file2.txt"));
@@ -352,10 +352,10 @@ void test_cherrypick_workdir__both_renamed(void)
352352
cl_assert(strcmp(git_str_cstr(&mergemsg_buf),
353353
"Renamed file3.txt -> file3.txt.renamed\n" \
354354
"\n" \
355-
"Conflicts:\n" \
356-
"\tfile3.txt\n" \
357-
"\tfile3.txt.renamed\n" \
358-
"\tfile3.txt.renamed_on_branch\n") == 0);
355+
"#Conflicts:\n" \
356+
"#\tfile3.txt\n" \
357+
"#\tfile3.txt.renamed\n" \
358+
"#\tfile3.txt.renamed_on_branch\n") == 0);
359359

360360
git_str_dispose(&mergemsg_buf);
361361
git_commit_free(commit);

tests/merge/workdir/simple.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ void test_merge_workdir_simple__mergefile(void)
278278
cl_assert(strcmp(git_str_cstr(&mergemsg_buf),
279279
"Merge commit '7cb63eed597130ba4abb87b3e544b85021905520'\n" \
280280
"\n" \
281-
"Conflicts:\n" \
282-
"\tconflicting.txt\n") == 0);
281+
"#Conflicts:\n" \
282+
"#\tconflicting.txt\n") == 0);
283283
git_str_dispose(&conflicting_buf);
284284
git_str_dispose(&mergemsg_buf);
285285

tests/revert/workdir.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,8 @@ void test_revert_workdir__conflicts(void)
119119
"\n" \
120120
"This reverts commit 72333f47d4e83616630ff3b0ffe4c0faebcc3c45.\n"
121121
"\n" \
122-
"Conflicts:\n" \
123-
"\tfile1.txt\n") == 0);
122+
"#Conflicts:\n" \
123+
"#\tfile1.txt\n") == 0);
124124

125125
git_commit_free(commit);
126126
git_commit_free(head);

0 commit comments

Comments
 (0)