@matheusbsbs / matheus-bagliano / commits / f7d24bbefb
Fork 0

merge with /dev/null as base, instead of punting O==empty case

Instead of leaving the path unmerged in a case where each side adds different version of the same path, attempt to merge it with empty base and leave "our" version in the index file, just like we do for the case in conflicting merge. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Nov 7, 2005 at 22:03 UTC f7d24bbefb06c40f7738f471dda561ab45496d24
1 file changed +16 -4
git-merge-one-file.sh
+16 -4
@@ -40,7 +40,7 @@ case "${1:-.}${2:-.}${3:-.}" in
40 ;;
41
42 #
43 -# Added in both (check for same permissions).
43 +# Added in both, identically (check for same permissions).
44 #
45 ".$3$2")
46 if [ "$6" != "$7" ]; then
@@ -56,9 +56,18 @@ case "${1:-.}${2:-.}${3:-.}" in
56 #
57 # Modified in both, but differently.
58 #
59 -"$1$2$3")
60 - echo "Auto-merging $4."
61 - orig=`git-unpack-file $1`
59 +"$1$2$3" | ".$2$3")
60 + case "$1" in
61 + '')
62 + echo "Added $4 in both, but differently."
63 + orig=`git-unpack-file $2`
64 + : >$orig
65 + ;;
66 + *)
67 + echo "Auto-merging $4."
68 + orig=`git-unpack-file $1`
69 + ;;
70 + esac
71 src2=`git-unpack-file $3`
72
73 # We reset the index to the first branch, making
@@ -73,6 +82,9 @@ case "${1:-.}${2:-.}${3:-.}" in
82 echo "ERROR: Permissions conflict: $5->$6,$7."
83 ret=1
84 fi
85 + if [ "$1" = '' ]; then
86 + ret=1
87 + fi
88
89 if [ $ret -ne 0 ]; then
90 echo "ERROR: Merge conflict in $4."