From: Matthijs Kooijman Date: Thu, 13 Aug 2009 09:43:38 +0000 (+0200) Subject: git: Make the git-wrapper script a bit more readable. X-Git-Url: https://git.stderr.nl/gitweb?p=matthijs%2Fservers%2Fdrsnuggles.git;a=commitdiff_plain;h=d67b176d349ef991f5efdb678841b36ff1eae73c git: Make the git-wrapper script a bit more readable. --- diff --git a/usr/local/bin/git-wrapper b/usr/local/bin/git-wrapper index 43da4e1..1920599 100755 --- a/usr/local/bin/git-wrapper +++ b/usr/local/bin/git-wrapper @@ -10,6 +10,11 @@ BASE_PATH='/data/vcs/git' +function init_repos() { + mkdir "$1" &> /dev/null || return 1 + (cd $1 && git --bare init &> /dev/null) || return 1 +} + # We keep an array of arguments, so we can handle quoting an spaces in # arguments properly. ARGS=() @@ -30,7 +35,7 @@ do # When the client wants us to receive a pack, create the git # repository if it does not exist yet if [ "`basename $0`" = "git-receive-pack" -a ! -e "$DIR" ]; then - mkdir "$DIR" &> /dev/null && (cd $DIR && git --bare init &> /dev/null) + init_repos "$DIR" fi ARGS[$i]="$DIR" else