Code

Merge branch 'mm/maint-hint-failed-merge'
[git.git] / remote-curl.c
index 0d7cf16e9c06d556cad8d92b6598a8da079426a4..a331bae6c8e95042dc2d136fdc1ef6b3d4463c53 100644 (file)
@@ -307,7 +307,7 @@ static size_t rpc_out(void *ptr, size_t eltsize,
                rpc->len = avail;
        }
 
-       if (max < avail);
+       if (max < avail)
                avail = max;
        memcpy(ptr, rpc->buf + rpc->pos, avail);
        rpc->pos += avail;
@@ -356,8 +356,8 @@ static int post_rpc(struct rpc_state *rpc)
        slot = get_active_slot();
        slot->results = &results;
 
-       curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
        curl_easy_setopt(slot->curl, CURLOPT_NOBODY, 0);
+       curl_easy_setopt(slot->curl, CURLOPT_POST, 1);
        curl_easy_setopt(slot->curl, CURLOPT_URL, rpc->service_url);
        curl_easy_setopt(slot->curl, CURLOPT_ENCODING, "");
 
@@ -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 ")) {