summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 26c8a53)
raw | patch | inline | side by side (parent: 26c8a53)
author | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 8 Jul 2005 23:22:22 +0000 (16:22 -0700) | ||
committer | Linus Torvalds <torvalds@g5.osdl.org> | |
Fri, 8 Jul 2005 23:22:22 +0000 (16:22 -0700) |
Do the default "try xyz.git xyz fails" thing for the directory we get
passed in.
passed in.
receive-pack.c | patch | blob | history | |
upload-pack.c | patch | blob | history |
diff --git a/receive-pack.c b/receive-pack.c
index 1768c875311d43a35636bab37d547c199a12b6e1..f39703f7af9ae809b144b0f074561756717bf04a 100644 (file)
--- a/receive-pack.c
+++ b/receive-pack.c
/* 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);
}
diff --git a/upload-pack.c b/upload-pack.c
index 6d844cc3199ae5bda475ec57bef4efb4901176bb..95d38120517e31f9c539daeaaec0b75da25f1e82 100644 (file)
--- a/upload-pack.c
+++ b/upload-pack.c
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);