+# Do not create subdirectories without asking first
+repodir=$(dirname $repopath)
+if [ ! -d "$git_root/$repodir" ]; then
+ if [ ! $yes ]; then
+ echo -n "Create git subdir '$repodir' (y/N)? "
+ read ans
+ ans=$(expr "$ans" : '\(.\).*') # works with dash too
+ if [ "$ans" != "y" -a "$ans" != "Y" ];then
+ echo "repository creation aborted at user request"
+ exit 0
+ fi
+ fi
+ mkdir -p "$git_root/$repodir" 2>/dev/null
+ if [ ! -d "$git_root/$repodir" ]; then
+ echo "%0: repository not created, git subdir '$repodir' create failed" >&2
+ exit 1
+ fi
+fi
+