1. Stefan Saasen
  2. git

Commits

Linus Torvalds  committed 113b947

Make "upload-pack" match git-fetch-pack usage

Do the default "try xyz.git xyz fails" thing for the directory we get
passed in.

  • Participants
  • Parent commits 26c8a53
  • Branches master

Comments (0)

Files changed (2)

File receive-pack.c

View file
 
 	/* 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);
 	}
 

File upload-pack.c

View file
 	if (argc != 2)
 		usage(upload_pack_usage);
 	dir = argv[1];
-	if (chdir(dir))
-		die("git-upload-pack unable to chdir to %s", dir);
+
+	/* chdir to the directory. If that fails, try appending ".git" */
+	if (chdir(dir) < 0) {
+		if (chdir(mkpath("%s.git", dir)) < 0)
+			die("git-upload-pack unable to chdir to %s", dir);
+	}
 	chdir(".git");
 	if (access("objects", X_OK) || access("refs", X_OK))
 		die("git-upload-pack: %s doesn't seem to be a git archive", dir);