Another fix for PATH and msysgit.
[gitweb.git] / test.sh
diff --git a/test.sh b/test.sh
index d0a2c86c243ae6e68b4c6cb76f60d61339be859c..45237c337492a4deefe918662967faf4add2e9f8 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -21,6 +21,19 @@ check()
        fi
 }
 
+check_not()
+{
+       echo
+       echo "check: NOT " "$@"
+       if "$@"; then
+               echo FAILED
+               exit 1
+       else
+               echo ok
+               return 0
+       fi
+}
+
 check_equal()
 {
        echo
@@ -60,7 +73,7 @@ undo()
 
 last_commit_message()
 {
-       git log --format=%s -1
+       git log --pretty=format:%s -1
 }
 
 rm -rf mainline subproj
@@ -94,6 +107,8 @@ git fetch ../subproj sub1
 git branch sub1 FETCH_HEAD
 
 # check if --message works for add
+check_not git subtree merge --prefix=subdir sub1
+check_not git subtree pull --prefix=subdir ../subproj sub1
 git subtree add --prefix=subdir --message="Added subproject" sub1
 check_equal "$(last_commit_message)" "Added subproject"
 undo
@@ -146,7 +161,8 @@ check_equal "You must provide the --prefix option." "$result"
 
 # Check that the <prefix> exists for a split.
 ! result=$(git subtree split --prefix=non-existent-directory 2>&1)
-check_equal "non-existent-directory does not exist." "$result"
+check_equal "'non-existent-directory' does not exist; use 'git subtree add'" \
+  "$result"
 
 # check if --message works for split+rejoin
 spl1=$(git subtree split --annotate='*' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)
@@ -276,8 +292,17 @@ git subtree split --prefix subdir --branch mainsub4
 # at this point, the new commit's parent should be sub3
 # if it's not, something went wrong (the "newparent" of "master~" commit should have been sub3,
 # but it wasn't, because it's cache was not set to itself)
-check_equal "$(git log --format=%P -1 mainsub4)" "$(git rev-parse sub3)"
+check_equal "$(git log --pretty=format:%P -1 mainsub4)" "$(git rev-parse sub3)"
+
+mkdir subdir2
+create subdir2/main-sub5
+git commit -m "main-sub5"
+git subtree split --prefix subdir2 --branch mainsub5
 
+# also test that we still can split out an entirely new subtree
+# if the parent of the first commit in the tree isn't empty,
+# then the new subtree has accidently been attached to something
+check_equal "$(git log --pretty=format:%P -1 mainsub5)" ""
 
 
 # make sure no patch changes more than one file.  The original set of commits