Make sure that <prefix> exists when splitting.
[gitweb.git] / test.sh
diff --git a/test.sh b/test.sh
index cfe3a3c2585ea67a432e7e90b0ed131499270846..d0a2c86c243ae6e68b4c6cb76f60d61339be859c 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -140,6 +140,14 @@ git subtree merge --prefix=subdir FETCH_HEAD
 git branch pre-split
 check_equal "$(last_commit_message)" "Merge commit '$(git rev-parse sub2)' into mainline"
 
+# Check that prefix argument is required for split (exits with warning and exit status = 1)
+! result=$(git subtree split 2>&1)
+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 if --message works for split+rejoin
 spl1=$(git subtree split --annotate='*' --prefix subdir --onto FETCH_HEAD --message "Split & rejoin" --rejoin)
 echo "spl1={$spl1}"