@matheusbsbs / matheus-bagliano / commits / 606475f317
Fork 0

Remove filename from conflict markers

Put filenames into the conflict markers only when they are different. Otherwise they are redundant information clutter. Print the filename explicitely when warning about a binary conflict. Signed-off-by: Martin Renold <martinxyz@gmx.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Martin Renold committed Jul 1, 2009 at 22:18 UTC 606475f3178784e5a6b3a01dce1a54314345cf43
4 files changed +17 -13
ll-merge.c
+4 -4
@@ -55,7 +55,7 @@ static int ll_binary_merge(const struct ll_merge_driver *drv_unused,
55
56 static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
57 mmbuffer_t *result,
58 - const char *path_unused,
58 + const char *path,
59 mmfile_t *orig,
60 mmfile_t *src1, const char *name1,
61 mmfile_t *src2, const char *name2,
@@ -67,10 +67,10 @@ static int ll_xdl_merge(const struct ll_merge_driver *drv_unused,
67 if (buffer_is_binary(orig->ptr, orig->size) ||
68 buffer_is_binary(src1->ptr, src1->size) ||
69 buffer_is_binary(src2->ptr, src2->size)) {
70 - warning("Cannot merge binary files: %s vs. %s\n",
71 - name1, name2);
70 + warning("Cannot merge binary files: %s (%s vs. %s)\n",
71 + path, name1, name2);
72 return ll_binary_merge(drv_unused, result,
73 - path_unused,
73 + path,
74 orig, src1, name1,
75 src2, name2,
76 virtual_ancestor);
merge-recursive.c
+7 -2
@@ -622,8 +622,13 @@ static int merge_3way(struct merge_options *o,
622 char *name1, *name2;
623 int merge_status;
624
625 - name1 = xstrdup(mkpath("%s:%s", branch1, a->path));
626 - name2 = xstrdup(mkpath("%s:%s", branch2, b->path));
625 + if (strcmp(a->path, b->path)) {
626 + name1 = xstrdup(mkpath("%s:%s", branch1, a->path));
627 + name2 = xstrdup(mkpath("%s:%s", branch2, b->path));
628 + } else {
629 + name1 = xstrdup(mkpath("%s", branch1));
630 + name2 = xstrdup(mkpath("%s", branch2));
631 + }
632
633 fill_mm(one->sha1, &orig);
634 fill_mm(a->sha1, &src1);
t/t3404-rebase-interactive.sh
+2 -2
@@ -119,11 +119,11 @@ index e69de29..00750ed 100644
119 EOF
120
121 cat > expect2 << EOF
122 -<<<<<<< HEAD:file1
122 +<<<<<<< HEAD
123 2
124 =======
125 3
126 ->>>>>>> b7ca976... G:file1
126 +>>>>>>> b7ca976... G
127 EOF
128
129 test_expect_success 'stop on conflicting pick' '
t/t6024-recursive-merge.sh
+4 -5
@@ -65,18 +65,18 @@ test_expect_success "combined merge conflicts" "
65 "
66
67 cat > expect << EOF
68 -<<<<<<< HEAD:a1
68 +<<<<<<< HEAD
69 F
70 =======
71 G
72 ->>>>>>> G:a1
72 +>>>>>>> G
73 EOF
74
75 test_expect_success "result contains a conflict" "test_cmp expect a1"
76
77 git ls-files --stage > out
78 cat > expect << EOF
79 -100644 da056ce14a2241509897fa68bb2b3b6e6194ef9e 1 a1
79 +100644 439cc46de773d8a83c77799b7cc9191c128bfcff 1 a1
80 100644 cf84443e49e1b366fac938711ddf4be2d4d1d9e9 2 a1
81 100644 fd7923529855d0b274795ae3349c5e0438333979 3 a1
82 EOF
@@ -93,8 +93,7 @@ test_expect_success 'refuse to merge binary files' '
93 git add binary-file &&
94 git commit -m binary2 &&
95 test_must_fail git merge F > merge.out 2> merge.err &&
96 - grep "Cannot merge binary files: HEAD:binary-file vs. F:binary-file" \
97 - merge.err
96 + grep "Cannot merge binary files: binary-file (HEAD vs. F)" merge.err
97 '
98
99 test_expect_success 'mark rename/delete as unmerged' '