git: Only create repositories for git-receive-pack.
[matthijs/servers/drsnuggles.git] / 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"