Merge branch 'mh/transport-capabilities'
authorJunio C Hamano <gitster@pobox.com>
Wed, 25 Feb 2015 23:40:19 +0000 (15:40 -0800)
committerJunio C Hamano <gitster@pobox.com>
Wed, 25 Feb 2015 23:40:20 +0000 (15:40 -0800)
The transport-helper did not give transport options such as
verbosity, progress, cloning, etc. to import and export based
helpers, like it did for fetch and push based helpers, robbing them
the chance to honor the wish of the end-users better.

* mh/transport-capabilities:
transport-helper: ask the helper to set the same options for import as for fetch
transport-helper: ask the helper to set progress and verbosity options after asking for its capabilities

1  2 
transport-helper.c
diff --combined transport-helper.c
index 7dc4a443aee0c6220dc0581d4bcfdd1d65da1d8a,c3868e453183aa2a23dcd1a45c2b3d7b4fc0d274..5d99a6bc2e7a10d40f6d8213e2f3cad254dbdb04
@@@ -5,6 -5,7 +5,6 @@@
  #include "commit.h"
  #include "diff.h"
  #include "revision.h"
 -#include "quote.h"
  #include "remote.h"
  #include "string-list.h"
  #include "thread-utils.h"
@@@ -97,6 -98,8 +97,8 @@@ static void do_take_over(struct transpo
        free(data);
  }
  
+ static void standard_options(struct transport *t);
  static struct child_process *get_helper(struct transport *transport)
  {
        struct helper_data *data = transport->data;
        strbuf_release(&buf);
        if (debug)
                fprintf(stderr, "Debug: Capabilities complete.\n");
+       standard_options(transport);
        return data->helper;
  }
  
@@@ -338,25 -342,13 +341,14 @@@ static int fetch_with_fetch(struct tran
        int i;
        struct strbuf buf = STRBUF_INIT;
  
-       standard_options(transport);
-       if (data->check_connectivity &&
-           data->transport_options.check_self_contained_and_connected)
-               set_helper_option(transport, "check-connectivity", "true");
-       if (transport->cloning)
-               set_helper_option(transport, "cloning", "true");
-       if (data->transport_options.update_shallow)
-               set_helper_option(transport, "update-shallow", "true");
        for (i = 0; i < nr_heads; i++) {
                const struct ref *posn = to_fetch[i];
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
  
                strbuf_addf(&buf, "fetch %s %s\n",
 -                          sha1_to_hex(posn->old_sha1), posn->name);
 +                          sha1_to_hex(posn->old_sha1),
 +                          posn->symref ? posn->symref : posn->name);
        }
  
        strbuf_addch(&buf, '\n');
@@@ -454,8 -446,7 +446,8 @@@ static int fetch_with_import(struct tra
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
  
 -              strbuf_addf(&buf, "import %s\n", posn->name);
 +              strbuf_addf(&buf, "import %s\n",
 +                          posn->symref ? posn->symref : posn->name);
                sendline(data, &buf);
                strbuf_reset(&buf);
        }
         * fast-forward or this is a forced update.
         */
        for (i = 0; i < nr_heads; i++) {
 -              char *private;
 +              char *private, *name;
                posn = to_fetch[i];
                if (posn->status & REF_STATUS_UPTODATE)
                        continue;
 +              name = posn->symref ? posn->symref : posn->name;
                if (data->refspecs)
 -                      private = apply_refspecs(data->refspecs, data->refspec_nr, posn->name);
 +                      private = apply_refspecs(data->refspecs, data->refspec_nr, name);
                else
 -                      private = xstrdup(posn->name);
 +                      private = xstrdup(name);
                if (private) {
                        read_ref(private, posn->old_sha1);
                        free(private);
@@@ -622,6 -612,16 +614,16 @@@ static int fetch(struct transport *tran
        if (!count)
                return 0;
  
+       if (data->check_connectivity &&
+           data->transport_options.check_self_contained_and_connected)
+               set_helper_option(transport, "check-connectivity", "true");
+       if (transport->cloning)
+               set_helper_option(transport, "cloning", "true");
+       if (data->transport_options.update_shallow)
+               set_helper_option(transport, "update-shallow", "true");
        if (data->fetch)
                return fetch_with_fetch(transport, nr_heads, to_fetch);
  
@@@ -826,7 -826,6 +828,6 @@@ static int push_refs_with_push(struct t
                return 0;
        }
  
-       standard_options(transport);
        for_each_string_list_item(cas_option, &cas_options)
                set_helper_option(transport, "cas", cas_option->string);
  
@@@ -862,7 -861,7 +863,7 @@@ static int push_refs_with_export(struc
                        die("helper %s does not support dry-run", data->name);
        } else if (flags & TRANSPORT_PUSH_CERT) {
                if (set_helper_option(transport, TRANS_OPT_PUSH_CERT, "true") != 0)
 -                      die("helper %s does not support dry-run", data->name);
 +                      die("helper %s does not support --signed", data->name);
        }
  
        if (flags & TRANSPORT_PUSH_FORCE) {