diff options
-rwxr-xr-x | git-shell-commands/change-description | 2 | ||||
-rwxr-xr-x | git-shell-commands/create-bare-repo | 10 | ||||
-rwxr-xr-x | git-shell-commands/delete-repo | 16 |
3 files changed, 22 insertions, 6 deletions
diff --git a/git-shell-commands/change-description b/git-shell-commands/change-description index a4cb197..730777c 100755 --- a/git-shell-commands/change-description +++ b/git-shell-commands/change-description @@ -7,6 +7,6 @@ set -e repo=$1; shift -echo "${@}" > ${repo}.git/description +test -d ${repo}.git && echo "${@}" > ${repo}.git/description exit $? diff --git a/git-shell-commands/create-bare-repo b/git-shell-commands/create-bare-repo index 6c83bc6..a6e49e3 100755 --- a/git-shell-commands/create-bare-repo +++ b/git-shell-commands/create-bare-repo @@ -5,13 +5,13 @@ set -e -for i in $@; do +for repo in $@; do # Cleanup names - repo="`echo "$i" | sed "s/[^a-z0-9\._-]//gi"`" + repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" + test ! -d "$repo".git && continue - if [ -z "$repo" ]; then continue; fi - - mkdir "$repo".git + mkdir -p "$repo".git pushd "$repo".git git init --bare + popd done diff --git a/git-shell-commands/delete-repo b/git-shell-commands/delete-repo new file mode 100755 index 0000000..075f77a --- /dev/null +++ b/git-shell-commands/delete-repo @@ -0,0 +1,16 @@ +#!/bin/sh +# * delete-repo +# Allows users to delete repositories permanently +# ssh git@host delete-repo repo1 repo2 ... + +set -e + +for repo in $@; do +# Remove leading slashes and dots and perform cleanup + repo="`echo "$repo" | sed -e "s,^[/\.]\+,,g" -e "s,[^a-z0-9\./_-],,gi"`" + test ! -d "$repo".git && continue + + echo "Removing ${repo}.git" + # lo and behold absolute horror + rm -rf "$repo".git +done |