Make "git checkout" create new branches on demand
[gitweb.git] / receive-pack.c
index 1768c875311d43a35636bab37d547c199a12b6e1..f39703f7af9ae809b144b0f074561756717bf04a 100644 (file)
@@ -197,9 +197,7 @@ int main(int argc, char **argv)
 
        /* chdir to the directory. If that fails, try appending ".git" */
        if (chdir(dir) < 0) {
-               static char path[PATH_MAX];
-               snprintf(path, sizeof(path), "%s.git", dir);
-               if (chdir(path) < 0)
+               if (chdir(mkpath("%s.git", dir)) < 0)
                        die("unable to cd to %s", dir);
        }