Merge branch 'jk/send-pack-many-refspecs'
authorJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2014 18:38:31 +0000 (11:38 -0700)
committerJunio C Hamano <gitster@pobox.com>
Fri, 19 Sep 2014 18:38:31 +0000 (11:38 -0700)
The number of refs that can be pushed at once over smart HTTP was
limited by the command line length. The limitation has been lifted
by passing these refs from the standard input of send-pack.

* jk/send-pack-many-refspecs:
send-pack: take refspecs over stdin

1  2 
remote-curl.c
diff --combined remote-curl.c
index 017ddd9284d77e65f0d005649adbcc8a38e3a538,558b9fecdf5bca1deb2577a51b1e8473e3350911..645872a4f204a51e915eecdf951613ac09277e8b
@@@ -623,9 -623,10 +623,9 @@@ static int rpc_service(struct rpc_stat
        const char *svc = rpc->service_name;
        struct strbuf buf = STRBUF_INIT;
        struct strbuf *preamble = rpc->stdin_preamble;
 -      struct child_process client;
 +      struct child_process client = CHILD_PROCESS_INIT;
        int err = 0;
  
 -      memset(&client, 0, sizeof(client));
        client.in = -1;
        client.out = -1;
        client.git_cmd = 1;
@@@ -862,6 -863,7 +862,7 @@@ static int push_git(struct discovery *h
        int i, err;
        struct argv_array args;
        struct string_list_item *cas_option;
+       struct strbuf preamble = STRBUF_INIT;
  
        argv_array_init(&args);
        argv_array_pushl(&args, "send-pack", "--stateless-rpc", "--helper-status",
        for_each_string_list_item(cas_option, &cas_options)
                argv_array_push(&args, cas_option->string);
        argv_array_push(&args, url.buf);
+       argv_array_push(&args, "--stdin");
        for (i = 0; i < nr_spec; i++)
-               argv_array_push(&args, specs[i]);
+               packet_buf_write(&preamble, "%s\n", specs[i]);
+       packet_buf_flush(&preamble);
  
        memset(&rpc, 0, sizeof(rpc));
        rpc.service_name = "git-receive-pack",
        rpc.argv = args.argv;
+       rpc.stdin_preamble = &preamble;
  
        err = rpc_service(&rpc, heads);
        if (rpc.result.len)
                write_or_die(1, rpc.result.buf, rpc.result.len);
        strbuf_release(&rpc.result);
+       strbuf_release(&preamble);
        argv_array_clear(&args);
        return err;
  }