git: Only create repositories for git-receive-pack.
authorMatthijs Kooijman <matthijs@stdin.nl>
Thu, 13 Aug 2009 09:34:43 +0000 (11:34 +0200)
committerMatthijs Kooijman <matthijs@stdin.nl>
Thu, 13 Aug 2009 09:34:43 +0000 (11:34 +0200)
This prevents empty repositories from being created when a typo is made
when fetching.

usr/local/bin/git-wrapper

index cd8f7c1d4a11cc2ede3ddd724b7cbfab261a08b9..43da4e1d77b1086a0472bb8950f26f7d6496874f 100755 (executable)
@@ -27,8 +27,9 @@ do
                        DIR="$BASE_PATH/$DIR"
                fi
        
-               # Create the git repository if it does not exist yet    
-               if [ ! -e "$DIR" ]; then
+               # 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)
                fi
                ARGS[$i]="$DIR"