]> git.ipfire.org Git - thirdparty/git.git/commitdiff
[PATCH] SCSI trees, merges and git status
authorJames Bottomley <James.Bottomley@SteelEye.com>
Tue, 19 Apr 2005 02:55:19 +0000 (19:55 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org.(none)>
Tue, 19 Apr 2005 02:55:19 +0000 (19:55 -0700)
Doing the latest SCSI merge exposed two bugs in your merge script:

1) It doesn't like a completely new directory (the misc tree contains a
   new drivers/scsi/lpfc)
2) the merge testing logic is wrong.  You only want to exit 1 if the
   merge fails.

git-merge-one-file-script

index df1a679c9b0a19637be932e242591b9b4796fa75..b2adc5fc4583e6089f4b38a47e1a73caad183f20 100755 (executable)
 # do any merges that migth change the tree layout
 #
 
+# if the directory is newly added in a branch, it might not exist
+# in the current tree
+dir=$(dirname "$4")
+mkdir -p "$dir"
+
 case "${1:-.}${2:-.}${3:-.}" in
 #
 # deleted in both, or deleted in one and unchanged in the other
@@ -40,7 +45,11 @@ case "${1:-.}${2:-.}${3:-.}" in
        orig=$(unpack-file $1)
        src1=$(unpack-file $2)
        src2=$(unpack-file $3)
-       merge "$src2" "$orig" "$src1" || echo Leaving conflict merge in $src2 && exit 1
+       merge "$src2" "$orig" "$src1"
+       if [ $? -ne 0 ]; then
+               echo Leaving conflict merge in $src2
+               exit 1
+       fi
        cp "$src2" "$4" && update-cache --add -- "$4" && exit 0
        ;;