Merge branch 'jk/clone-recursive-progress'
authorJunio C Hamano <gitster@pobox.com>
Mon, 26 Sep 2016 23:09:22 +0000 (16:09 -0700)
committerJunio C Hamano <gitster@pobox.com>
Mon, 26 Sep 2016 23:09:22 +0000 (16:09 -0700)
"git clone --recurse-submodules" lost the progress eye-candy in
recent update, which has been corrected.

* jk/clone-recursive-progress:
clone: pass --progress decision to recursive submodules

1  2 
builtin/submodule--helper.c
index 432794b13077b944111b76e9f11e20dff827ebba,a0c3427496123d08ff550df8c4656732421ee80a..e3fdc0aa7883e1050f4fe8a165ec6245ab9abc9e
@@@ -296,8 -296,7 +296,8 @@@ static int module_list(int argc, const 
                if (ce_stage(ce))
                        printf("%06o %s U\t", ce->ce_mode, sha1_to_hex(null_sha1));
                else
 -                      printf("%06o %s %d\t", ce->ce_mode, sha1_to_hex(ce->sha1), ce_stage(ce));
 +                      printf("%06o %s %d\t", ce->ce_mode,
 +                             oid_to_hex(&ce->oid), ce_stage(ce));
  
                utf8_fprintf(stdout, "%s\n", ce->name);
        }
@@@ -443,7 -442,8 +443,8 @@@ static int module_name(int argc, const 
  }
  
  static int clone_submodule(const char *path, const char *gitdir, const char *url,
-                          const char *depth, struct string_list *reference, int quiet)
+                          const char *depth, struct string_list *reference,
+                          int quiet, int progress)
  {
        struct child_process cp = CHILD_PROCESS_INIT;
  
        argv_array_push(&cp.args, "--no-checkout");
        if (quiet)
                argv_array_push(&cp.args, "--quiet");
+       if (progress)
+               argv_array_push(&cp.args, "--progress");
        if (depth && *depth)
                argv_array_pushl(&cp.args, "--depth", depth, NULL);
        if (reference->nr) {
@@@ -575,6 -577,7 +578,7 @@@ static int module_clone(int argc, cons
  {
        const char *name = NULL, *url = NULL, *depth = NULL;
        int quiet = 0;
+       int progress = 0;
        FILE *submodule_dot_git;
        char *p, *path = NULL, *sm_gitdir;
        struct strbuf rel_path = STRBUF_INIT;
                           N_("string"),
                           N_("depth for shallow clones")),
                OPT__QUIET(&quiet, "Suppress output for cloning a submodule"),
+               OPT_BOOL(0, "progress", &progress,
+                          N_("force cloning progress")),
                OPT_END()
        };
  
  
                prepare_possible_alternates(name, &reference);
  
-               if (clone_submodule(path, sm_gitdir, url, depth, &reference, quiet))
+               if (clone_submodule(path, sm_gitdir, url, depth, &reference,
+                                   quiet, progress))
                        die(_("clone of '%s' into submodule path '%s' failed"),
                            url, path);
        } else {
@@@ -684,6 -690,7 +691,7 @@@ struct submodule_update_clone 
        struct submodule_update_strategy update;
  
        /* configuration parameters which are passed on to the children */
+       int progress;
        int quiet;
        int recommend_shallow;
        struct string_list references;
        int failed_clones_nr, failed_clones_alloc;
  };
  #define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \
-       SUBMODULE_UPDATE_STRATEGY_INIT, 0, -1, STRING_LIST_INIT_DUP, \
+       SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, \
        NULL, NULL, NULL, \
        STRING_LIST_INIT_DUP, 0, NULL, 0, 0}
  
@@@ -791,7 -798,7 +799,7 @@@ static int prepare_to_clone_next_submod
  
        strbuf_reset(&sb);
        strbuf_addf(&sb, "%06o %s %d %d\t%s\n", ce->ce_mode,
 -                      sha1_to_hex(ce->sha1), ce_stage(ce),
 +                      oid_to_hex(&ce->oid), ce_stage(ce),
                        needs_cloning, ce->name);
        string_list_append(&suc->projectlines, sb.buf);
  
        child->err = -1;
        argv_array_push(&child->args, "submodule--helper");
        argv_array_push(&child->args, "clone");
+       if (suc->progress)
+               argv_array_push(&child->args, "--progress");
        if (suc->quiet)
                argv_array_push(&child->args, "--quiet");
        if (suc->prefix)
@@@ -860,9 -869,8 +870,9 @@@ static int update_clone_get_next_task(s
                ce = suc->failed_clones[index];
                if (!prepare_to_clone_next_submodule(ce, child, suc, err)) {
                        suc->current ++;
 -                      strbuf_addf(err, "BUG: submodule considered for cloning,"
 -                                  "doesn't need cloning any more?\n");
 +                      strbuf_addstr(err, "BUG: submodule considered for "
 +                                         "cloning, doesn't need cloning "
 +                                         "any more?\n");
                        return 0;
                }
                p = xmalloc(sizeof(*p));
@@@ -951,6 -959,8 +961,8 @@@ static int update_clone(int argc, cons
                OPT_BOOL(0, "recommend-shallow", &suc.recommend_shallow,
                            N_("whether the initial clone should follow the shallow recommendation")),
                OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
+               OPT_BOOL(0, "progress", &suc.progress,
+                           N_("force cloning progress")),
                OPT_END()
        };