X-Git-Url: https://asedeno.scripts.mit.edu/gitweb/?a=blobdiff_plain;f=git-merge-one-file.sh;h=9c2c1b7202462370509a7bdb391982ae32564bd6;hb=adfd55d51bff3bfcf17c3cd40d0689fb018c14cf;hp=9ee3f804520eadb322de3d0ea70a2bf9f092b089;hpb=4698ef555a1706fe322a68a02a21fb1087940ac3;p=git.git diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh index 9ee3f8045..9c2c1b720 100755 --- a/git-merge-one-file.sh +++ b/git-merge-one-file.sh @@ -48,10 +48,11 @@ case "${1:-.}${2:-.}${3:-.}" in ;; "..$3") echo "Adding $4" - test -f "$4" || { + if test -f "$4" + then echo "ERROR: untracked $4 is overwritten by the merge." exit 1 - } + fi git update-index --add --cacheinfo "$7" "$3" "$4" && exec git checkout-index -u -f -- "$4" ;; @@ -112,6 +113,10 @@ case "${1:-.}${2:-.}${3:-.}" in src1=`git-unpack-file $2` git merge-file "$src1" "$orig" "$src2" ret=$? + msg= + if [ $ret -ne 0 ]; then + msg='content conflict' + fi # Create the working tree file, using "our tree" version from the # index, and then store the result of the merge. @@ -119,7 +124,10 @@ case "${1:-.}${2:-.}${3:-.}" in rm -f -- "$orig" "$src1" "$src2" if [ "$6" != "$7" ]; then - echo "ERROR: Permissions conflict: $5->$6,$7." + if [ -n "$msg" ]; then + msg="$msg, " + fi + msg="${msg}permissions conflict: $5->$6,$7" ret=1 fi if [ "$1" = '' ]; then @@ -127,7 +135,7 @@ case "${1:-.}${2:-.}${3:-.}" in fi if [ $ret -ne 0 ]; then - echo "ERROR: Merge conflict in $4" + echo "ERROR: $msg in $4" exit 1 fi exec git update-index -- "$4"