X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=git-merge-one-file.sh;h=9c2c1b7202462370509a7bdb391982ae32564bd6;hb=36a83f375bc247a09f46de0445a138d5e6de8a4f;hp=e1eb9632660146396a0b5f3f2a410d8cb027ff9d;hpb=a0d74d160f3d416be8f7fbfd18fee0eebf40d8e0;p=git.git diff --git a/git-merge-one-file.sh b/git-merge-one-file.sh index e1eb96326..d067894bf 100755 --- a/git-merge-one-file.sh +++ b/git-merge-one-file.sh @@ -16,6 +16,18 @@ # been handled already by git read-tree, but that one doesn't # do any merges that might change the tree layout. +USAGE=' ' +USAGE="$USAGE " +LONG_USAGE="Usage: git merge-one-file $USAGE + +Blob ids and modes should be empty for missing files." + +if ! test "$#" -eq 7 +then + echo "$LONG_USAGE" + exit 1 +fi + case "${1:-.}${2:-.}${3:-.}" in # # Deleted in both or deleted in one and unchanged in the other @@ -113,6 +125,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. @@ -120,7 +136,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 @@ -128,7 +147,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"