show-branch: make it work in a subdirectory.
[gitweb.git] / git-merge-one-file-script
index 88ad3edd64acf92dd11d690c110d42bef23a6187..b791107fd73c87361f340fc1b0a43e53cecd2a8e 100755 (executable)
@@ -21,8 +21,12 @@ case "${1:-.}${2:-.}${3:-.}" in
 # Deleted in both or deleted in one and unchanged in the other
 #
 "$1.." | "$1.$1" | "$1$1.")
-       echo "Removing $4"
-       rm -f -- "$4" &&
+       if [ "$2" ]; then
+               echo "Removing $4"
+       fi
+       if test -f "$4"; then
+               rm -f -- "$4"
+       fi &&
                exec git-update-cache --remove -- "$4"
        ;;
 
@@ -59,7 +63,7 @@ case "${1:-.}${2:-.}${3:-.}" in
 
        # We reset the index to the first branch, making
        # git-diff-file useful
-       git-update-cache --add --cacheinfo "$6" "$2" "$4" 
+       git-update-cache --add --cacheinfo "$6" "$2" "$4"
                git-checkout-cache -u -f -- "$4" &&
                merge "$4" "$orig" "$src2"
        ret=$?