summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ec54f0d)
raw | patch | inline | side by side (parent: ec54f0d)
author | Avery Pennarun <apenwarr@gmail.com> | |
Mon, 8 Feb 2010 20:00:42 +0000 (15:00 -0500) | ||
committer | Avery Pennarun <apenwarr@gmail.com> | |
Mon, 8 Feb 2010 20:02:29 +0000 (15:02 -0500) |
For add, the prefix must *not* already exist. For all the other commands,
it *must* already exist.
it *must* already exist.
git-subtree.sh | patch | blob | history | |
test.sh | patch | blob | history |
diff --git a/git-subtree.sh b/git-subtree.sh
index 52d4c0aeb135d0e760516e38640d11229c66ca42..e76b45c2ddcdbd54b944aa72a774b45fa40cbfc3 100755 (executable)
--- a/git-subtree.sh
+++ b/git-subtree.sh
die "You must provide the --prefix option."
fi
-if [ "$command" = "split" -a """"! -e "$prefix" ]; then
- die "$prefix does not exist."
-fi
+case "$command" in
+ add) [ -e "$prefix" ] &&
+ die "prefix '$prefix' already exists." ;;
+ *) [ -e "$prefix" ] ||
+ die "'$prefix' does not exist; use 'git subtree add'" ;;
+esac
dir="$(dirname "$prefix/.")"
index d0a2c86c243ae6e68b4c6cb76f60d61339be859c..1446cfeed89071c9935d5fb9a8ea24ec0988d436 100755 (executable)
--- a/test.sh
+++ b/test.sh
fi
}
+check_not()
+{
+ echo
+ echo "check: NOT " "$@"
+ if "$@"; then
+ echo FAILED
+ exit 1
+ else
+ echo ok
+ return 0
+ fi
+}
+
check_equal()
{
echo
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