Skip to content

Commit

Permalink
Allow curl helper to work without a local repository
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Barkalow authored and Junio C Hamano committed Nov 4, 2009
1 parent c1d45cf commit a45d3d7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion remote-curl.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,10 @@ int main(int argc, const char **argv)
struct strbuf buf = STRBUF_INIT;
const char *url;
struct walker *walker = NULL;
int nongit;

git_extract_argv0_path(argv[0]);
setup_git_directory();
setup_git_directory_gently(&nongit);
if (argc < 2) {
fprintf(stderr, "Remote needed\n");
return 1;
Expand All @@ -103,6 +104,8 @@ int main(int argc, const char **argv)
break;
if (!prefixcmp(buf.buf, "fetch ")) {
char *obj = buf.buf + strlen("fetch ");
if (nongit)
die("Fetch attempted without a local repo");
if (!walker)
walker = get_http_walker(url, remote);
walker->get_all = 1;
Expand Down

0 comments on commit a45d3d7

Please sign in to comment.