@matheusbsbs / matheus-bagliano / commits / a45d3d7eff
Fork 0

Allow curl helper to work without a local repository

It's okay to use the curl helper without a local repository, so long as you don't use "fetch". There aren't any git programs that would try to use it, and it doesn't make sense to try it (since there's nowhere to write the results), but we may as well be clear. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Daniel Barkalow committed Nov 3, 2009 at 21:52 UTC a45d3d7effdfb4b6b9fe75c9206a79d3cdcb3922
1 file changed +4 -1
remote-curl.c
+4 -1
@@ -82,9 +82,10 @@ int main(int argc, const char **argv)
82 struct strbuf buf = STRBUF_INIT;
83 const char *url;
84 struct walker *walker = NULL;
85 + int nongit;
86
87 git_extract_argv0_path(argv[0]);
87 - setup_git_directory();
88 + setup_git_directory_gently(&nongit);
89 if (argc < 2) {
90 fprintf(stderr, "Remote needed\n");
91 return 1;
@@ -103,6 +104,8 @@ int main(int argc, const char **argv)
104 break;
105 if (!prefixcmp(buf.buf, "fetch ")) {
106 char *obj = buf.buf + strlen("fetch ");
107 + if (nongit)
108 + die("Fetch attempted without a local repo");
109 if (!walker)
110 walker = get_http_walker(url, remote);
111 walker->get_all = 1;