Skip to content

Commit 4fa5c05

Browse files
committed
merge-one-file: force content conflict for "both sides added" case
Historically, we tried to be lenient to "both sides added, slightly differently" case and as long as the files can be merged using a made-up common ancestor cleanly, since f7d24bb (merge with /dev/null as base, instead of punting O==empty case, 2005-11-07). This was later further refined to use a better made-up common file with fd66dbf (merge-one-file: use empty- or common-base condintionally in two-stage merge., 2005-11-10), but the spirit has been the same. But the original fix in f7d24bb to avoid punting on "both sides added" case had a code to unconditionally error out the merge. When this triggers, even though the content-level merge can be done cleanly, we end up not saying "content conflict" in the message, but still issue the error message, showing "ERROR: in <pathname>". Move that "always fail for add/add conflict" logic a bit higher to fix this. Signed-off-by: Junio C Hamano <gitster@pobox.com>
1 parent d401acf commit 4fa5c05

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

git-merge-one-file.sh

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,10 @@ case "${1:-.}${2:-.}${3:-.}" in
124124
git merge-file "$src1" "$orig" "$src2"
125125
ret=$?
126126
msg=
127-
if test $ret != 0
127+
if test $ret != 0 || test -z "$1"
128128
then
129129
msg='content conflict'
130+
ret=1
130131
fi
131132

132133
# Create the working tree file, using "our tree" version from the
@@ -143,10 +144,6 @@ case "${1:-.}${2:-.}${3:-.}" in
143144
msg="${msg}permissions conflict: $5->$6,$7"
144145
ret=1
145146
fi
146-
if test -z "$1"
147-
then
148-
ret=1
149-
fi
150147

151148
if test $ret != 0
152149
then

0 commit comments

Comments
 (0)