summaryrefslogtreecommitdiff
path: root/git-shell-commands/delete-repo
blob: 4ca644e8394b3dcc4179a35278daf2447d932dab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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,^/\+,,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