summaryrefslogtreecommitdiff
path: root/git-shell-commands/create-bare-repo
diff options
context:
space:
mode:
Diffstat (limited to 'git-shell-commands/create-bare-repo')
-rwxr-xr-xgit-shell-commands/create-bare-repo21
1 files changed, 11 insertions, 10 deletions
diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo
index 14a640b..3051c9d 100755
--- a/git-shell-commands/create-bare-repo
+++ b/git-shell-commands/create-bare-repo
@@ -1,16 +1,17 @@
#!/bin/sh
-# Allows users to create repo.git
-# $ ssh git@host create-bare-repo repo1 repo2 ...
+# * create-bare-repo
+# Allows users to create repo.git
+# ssh git@host create-bare-repo repo1 repo2 ...
-set -E
+set -e
-for i in $@; do
-# Cleanup names
- i="`echo "$i" | sed "s/[^a-z0-9\.\-\_]//gi"`"
+for repo in $@; do
+# Cleanup names, allow hidden repos
+ repo="`echo "$repo" | sed -e "s/\.\.//g" -e "s,^/\+,,g" -e "s,[^a-z0-9\./_-],,gi"`"
+ test -d "$repo".git && continue
- if [ -z "$i" ]; then continue; fi
-
- mkdir "$i".git
- pushd "$i".git
+ mkdir -p "$repo".git
+ pushd "$repo".git
git init --bare
+ popd
done