summaryrefslogtreecommitdiff
path: root/git-shell-commands/delete-repo
diff options
context:
space:
mode:
authorNicolás Reynolds <fauno@endefensadelsl.org>2013-09-11 01:37:48 -0300
committerNicolás Reynolds <fauno@endefensadelsl.org>2013-09-11 01:37:48 -0300
commit274e882c78f4e29820281608bd7c742dbf666717 (patch)
treedabf4d91f4b4ecdfc4a4c22253393a1b8dba0f57 /git-shell-commands/delete-repo
parentaf6871f6f4174f254e0ad6f00ccdaed9e68e4cb5 (diff)
parentae95c2980b8aa8459155381a6644027325c6385b (diff)
Merge branch 'delete-repo'
Diffstat (limited to 'git-shell-commands/delete-repo')
-rwxr-xr-xgit-shell-commands/delete-repo16
1 files changed, 16 insertions, 0 deletions
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