Code

Merge branch 'sp/smart-http'
[git.git] / remote-curl.c
index 0d7cf16e9c06d556cad8d92b6598a8da079426a4..4f28c222f2064b27c41bbcfbb425c6a221b46a58 100644 (file)
@@ -745,9 +745,10 @@ static void parse_push(struct strbuf *buf)
 int main(int argc, const char **argv)
 {
        struct strbuf buf = STRBUF_INIT;
+       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;
@@ -769,6 +770,8 @@ int main(int argc, const char **argv)
                if (strbuf_getline(&buf, stdin, '\n') == EOF)
                        break;
                if (!prefixcmp(buf.buf, "fetch ")) {
+                       if (nongit)
+                               die("Fetch attempted without a local repo");
                        parse_fetch(&buf);
 
                } else if (!strcmp(buf.buf, "list") || !prefixcmp(buf.buf, "list ")) {