aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Barkalow <barkalow@iabervon.org>2009-11-03 21:52:35 -0500
committerJunio C Hamano <gitster@pobox.com>2009-11-03 21:41:01 -0800
commita45d3d7effdfb4b6b9fe75c9206a79d3cdcb3922 (patch)
treede7f93446ee66fe178f7dec9fb54f0c51700d463
parentc1d45cf7b0c1953eed72a3018b5e557dbcd538e0 (diff)
downloadgit-a45d3d7effdfb4b6b9fe75c9206a79d3cdcb3922.tar.gz
git-a45d3d7effdfb4b6b9fe75c9206a79d3cdcb3922.tar.xz
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>
-rw-r--r--remote-curl.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/remote-curl.c b/remote-curl.c
index 2faf1c634..ebdab3603 100644
--- a/remote-curl.c
+++ b/remote-curl.c
@@ -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;
@@ -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;