diff options
author | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-08 16:22:22 -0700 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-08 16:22:22 -0700 |
commit | 113b94751d7f10617e22de0d017033a52b224c68 (patch) | |
tree | df72183f1ad2b747764051f7924d4bda9c170534 /upload-pack.c | |
parent | 26c8a533afac9540e46e7d7707d9179772c6d2c8 (diff) | |
download | git-113b94751d7f10617e22de0d017033a52b224c68.tar.gz |
Make "upload-pack" match git-fetch-pack usage
Do the default "try xyz.git xyz fails" thing for the directory we get
passed in.
Diffstat (limited to 'upload-pack.c')
-rw-r--r-- | upload-pack.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/upload-pack.c b/upload-pack.c index 6d844cc319..95d3812051 100644 --- a/upload-pack.c +++ b/upload-pack.c @@ -170,8 +170,12 @@ int main(int argc, char **argv) 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); |