For add, the prefix must *not* already exist. For all the other commands,
it *must* already exist.
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/.")"
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