X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=upload-pack.c;h=95d38120517e31f9c539daeaaec0b75da25f1e82;hb=bd6bc56d4ebf04113657647e6d071e24ca708dad;hp=9edbf51dc5aac854943ad34c001b11850000e2a7;hpb=bbca20accefe8329f976371d0d8c111c965cdf1a;p=git.git
diff --git a/upload-pack.c b/upload-pack.c
index 9edbf51d..95d38120 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -5,7 +5,7 @@
static const char upload_pack_usage[] = "git-upload-pack
";
#define MAX_HAS (16)
-#define MAX_NEEDS (16)
+#define MAX_NEEDS (256)
static int nr_has = 0, nr_needs = 0;
static unsigned char has_sha1[MAX_HAS][20];
static unsigned char needs_sha1[MAX_NEEDS][20];
@@ -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);