Skip to content

Commit a45d3d7

Browse files
iabervongitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c1d45cf commit a45d3d7

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

remote-curl.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ int main(int argc, const char **argv)
8282
struct strbuf buf = STRBUF_INIT;
8383
const char *url;
8484
struct walker *walker = NULL;
85+
int nongit;
8586

8687
git_extract_argv0_path(argv[0]);
87-
setup_git_directory();
88+
setup_git_directory_gently(&nongit);
8889
if (argc < 2) {
8990
fprintf(stderr, "Remote needed\n");
9091
return 1;
@@ -103,6 +104,8 @@ int main(int argc, const char **argv)
103104
break;
104105
if (!prefixcmp(buf.buf, "fetch ")) {
105106
char *obj = buf.buf + strlen("fetch ");
107+
if (nongit)
108+
die("Fetch attempted without a local repo");
106109
if (!walker)
107110
walker = get_http_walker(url, remote);
108111
walker->get_all = 1;

0 commit comments

Comments
 (0)