Make "upload-pack" match git-fetch-pack usage
Do the default "try xyz.git xyz fails" thing for the directory we get passed in.
This commit is contained in:
parent
26c8a533af
commit
113b94751d
@ -197,9 +197,7 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
/* chdir to the directory. If that fails, try appending ".git" */
|
/* chdir to the directory. If that fails, try appending ".git" */
|
||||||
if (chdir(dir) < 0) {
|
if (chdir(dir) < 0) {
|
||||||
static char path[PATH_MAX];
|
if (chdir(mkpath("%s.git", dir)) < 0)
|
||||||
snprintf(path, sizeof(path), "%s.git", dir);
|
|
||||||
if (chdir(path) < 0)
|
|
||||||
die("unable to cd to %s", dir);
|
die("unable to cd to %s", dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -170,8 +170,12 @@ int main(int argc, char **argv)
|
|||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
usage(upload_pack_usage);
|
usage(upload_pack_usage);
|
||||||
dir = argv[1];
|
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");
|
chdir(".git");
|
||||||
if (access("objects", X_OK) || access("refs", X_OK))
|
if (access("objects", X_OK) || access("refs", X_OK))
|
||||||
die("git-upload-pack: %s doesn't seem to be a git archive", dir);
|
die("git-upload-pack: %s doesn't seem to be a git archive", dir);
|
||||||
|
Loading…
Reference in New Issue
Block a user