Merge branch 'jk/clone-recursive-progress'
"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
This commit is contained in:
@ -670,7 +670,7 @@ static void update_head(const struct ref *our, const struct ref *remote,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static int checkout(void)
|
static int checkout(int submodule_progress)
|
||||||
{
|
{
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
char *head;
|
char *head;
|
||||||
@ -734,6 +734,9 @@ static int checkout(void)
|
|||||||
if (max_jobs != -1)
|
if (max_jobs != -1)
|
||||||
argv_array_pushf(&args, "--jobs=%d", max_jobs);
|
argv_array_pushf(&args, "--jobs=%d", max_jobs);
|
||||||
|
|
||||||
|
if (submodule_progress)
|
||||||
|
argv_array_push(&args, "--progress");
|
||||||
|
|
||||||
err = run_command_v_opt(args.argv, RUN_GIT_CMD);
|
err = run_command_v_opt(args.argv, RUN_GIT_CMD);
|
||||||
argv_array_clear(&args);
|
argv_array_clear(&args);
|
||||||
}
|
}
|
||||||
@ -841,6 +844,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
const char *src_ref_prefix = "refs/heads/";
|
const char *src_ref_prefix = "refs/heads/";
|
||||||
struct remote *remote;
|
struct remote *remote;
|
||||||
int err = 0, complete_refs_before_fetch = 1;
|
int err = 0, complete_refs_before_fetch = 1;
|
||||||
|
int submodule_progress;
|
||||||
|
|
||||||
struct refspec *refspec;
|
struct refspec *refspec;
|
||||||
const char *fetch_pattern;
|
const char *fetch_pattern;
|
||||||
@ -1099,6 +1103,14 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
update_head(our_head_points_at, remote_head, reflog_msg.buf);
|
update_head(our_head_points_at, remote_head, reflog_msg.buf);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* We want to show progress for recursive submodule clones iff
|
||||||
|
* we did so for the main clone. But only the transport knows
|
||||||
|
* the final decision for this flag, so we need to rescue the value
|
||||||
|
* before we free the transport.
|
||||||
|
*/
|
||||||
|
submodule_progress = transport->progress;
|
||||||
|
|
||||||
transport_unlock_pack(transport);
|
transport_unlock_pack(transport);
|
||||||
transport_disconnect(transport);
|
transport_disconnect(transport);
|
||||||
|
|
||||||
@ -1108,7 +1120,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
junk_mode = JUNK_LEAVE_REPO;
|
junk_mode = JUNK_LEAVE_REPO;
|
||||||
err = checkout();
|
err = checkout(submodule_progress);
|
||||||
|
|
||||||
strbuf_release(&reflog_msg);
|
strbuf_release(&reflog_msg);
|
||||||
strbuf_release(&branch_top);
|
strbuf_release(&branch_top);
|
||||||
|
@ -443,7 +443,8 @@ static int module_name(int argc, const char **argv, const char *prefix)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int clone_submodule(const char *path, const char *gitdir, const char *url,
|
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;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
|
|
||||||
@ -451,6 +452,8 @@ static int clone_submodule(const char *path, const char *gitdir, const char *url
|
|||||||
argv_array_push(&cp.args, "--no-checkout");
|
argv_array_push(&cp.args, "--no-checkout");
|
||||||
if (quiet)
|
if (quiet)
|
||||||
argv_array_push(&cp.args, "--quiet");
|
argv_array_push(&cp.args, "--quiet");
|
||||||
|
if (progress)
|
||||||
|
argv_array_push(&cp.args, "--progress");
|
||||||
if (depth && *depth)
|
if (depth && *depth)
|
||||||
argv_array_pushl(&cp.args, "--depth", depth, NULL);
|
argv_array_pushl(&cp.args, "--depth", depth, NULL);
|
||||||
if (reference->nr) {
|
if (reference->nr) {
|
||||||
@ -575,6 +578,7 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
|||||||
{
|
{
|
||||||
const char *name = NULL, *url = NULL, *depth = NULL;
|
const char *name = NULL, *url = NULL, *depth = NULL;
|
||||||
int quiet = 0;
|
int quiet = 0;
|
||||||
|
int progress = 0;
|
||||||
FILE *submodule_dot_git;
|
FILE *submodule_dot_git;
|
||||||
char *p, *path = NULL, *sm_gitdir;
|
char *p, *path = NULL, *sm_gitdir;
|
||||||
struct strbuf rel_path = STRBUF_INIT;
|
struct strbuf rel_path = STRBUF_INIT;
|
||||||
@ -601,6 +605,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
|||||||
N_("string"),
|
N_("string"),
|
||||||
N_("depth for shallow clones")),
|
N_("depth for shallow clones")),
|
||||||
OPT__QUIET(&quiet, "Suppress output for cloning a submodule"),
|
OPT__QUIET(&quiet, "Suppress output for cloning a submodule"),
|
||||||
|
OPT_BOOL(0, "progress", &progress,
|
||||||
|
N_("force cloning progress")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -634,7 +640,8 @@ static int module_clone(int argc, const char **argv, const char *prefix)
|
|||||||
|
|
||||||
prepare_possible_alternates(name, &reference);
|
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"),
|
die(_("clone of '%s' into submodule path '%s' failed"),
|
||||||
url, path);
|
url, path);
|
||||||
} else {
|
} else {
|
||||||
@ -684,6 +691,7 @@ struct submodule_update_clone {
|
|||||||
struct submodule_update_strategy update;
|
struct submodule_update_strategy update;
|
||||||
|
|
||||||
/* configuration parameters which are passed on to the children */
|
/* configuration parameters which are passed on to the children */
|
||||||
|
int progress;
|
||||||
int quiet;
|
int quiet;
|
||||||
int recommend_shallow;
|
int recommend_shallow;
|
||||||
struct string_list references;
|
struct string_list references;
|
||||||
@ -702,7 +710,7 @@ struct submodule_update_clone {
|
|||||||
int failed_clones_nr, failed_clones_alloc;
|
int failed_clones_nr, failed_clones_alloc;
|
||||||
};
|
};
|
||||||
#define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \
|
#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, \
|
NULL, NULL, NULL, \
|
||||||
STRING_LIST_INIT_DUP, 0, NULL, 0, 0}
|
STRING_LIST_INIT_DUP, 0, NULL, 0, 0}
|
||||||
|
|
||||||
@ -804,6 +812,8 @@ static int prepare_to_clone_next_submodule(const struct cache_entry *ce,
|
|||||||
child->err = -1;
|
child->err = -1;
|
||||||
argv_array_push(&child->args, "submodule--helper");
|
argv_array_push(&child->args, "submodule--helper");
|
||||||
argv_array_push(&child->args, "clone");
|
argv_array_push(&child->args, "clone");
|
||||||
|
if (suc->progress)
|
||||||
|
argv_array_push(&child->args, "--progress");
|
||||||
if (suc->quiet)
|
if (suc->quiet)
|
||||||
argv_array_push(&child->args, "--quiet");
|
argv_array_push(&child->args, "--quiet");
|
||||||
if (suc->prefix)
|
if (suc->prefix)
|
||||||
@ -951,6 +961,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
|
|||||||
OPT_BOOL(0, "recommend-shallow", &suc.recommend_shallow,
|
OPT_BOOL(0, "recommend-shallow", &suc.recommend_shallow,
|
||||||
N_("whether the initial clone should follow the shallow recommendation")),
|
N_("whether the initial clone should follow the shallow recommendation")),
|
||||||
OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
|
OPT__QUIET(&suc.quiet, N_("don't print cloning progress")),
|
||||||
|
OPT_BOOL(0, "progress", &suc.progress,
|
||||||
|
N_("force cloning progress")),
|
||||||
OPT_END()
|
OPT_END()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ update=
|
|||||||
prefix=
|
prefix=
|
||||||
custom_name=
|
custom_name=
|
||||||
depth=
|
depth=
|
||||||
|
progress=
|
||||||
|
|
||||||
die_if_unmatched ()
|
die_if_unmatched ()
|
||||||
{
|
{
|
||||||
@ -498,6 +499,9 @@ cmd_update()
|
|||||||
-q|--quiet)
|
-q|--quiet)
|
||||||
GIT_QUIET=1
|
GIT_QUIET=1
|
||||||
;;
|
;;
|
||||||
|
--progress)
|
||||||
|
progress="--progress"
|
||||||
|
;;
|
||||||
-i|--init)
|
-i|--init)
|
||||||
init=1
|
init=1
|
||||||
;;
|
;;
|
||||||
@ -573,6 +577,7 @@ cmd_update()
|
|||||||
|
|
||||||
{
|
{
|
||||||
git submodule--helper update-clone ${GIT_QUIET:+--quiet} \
|
git submodule--helper update-clone ${GIT_QUIET:+--quiet} \
|
||||||
|
${progress:+"$progress"} \
|
||||||
${wt_prefix:+--prefix "$wt_prefix"} \
|
${wt_prefix:+--prefix "$wt_prefix"} \
|
||||||
${prefix:+--recursive-prefix "$prefix"} \
|
${prefix:+--recursive-prefix "$prefix"} \
|
||||||
${update:+--update "$update"} \
|
${update:+--update "$update"} \
|
||||||
|
Reference in New Issue
Block a user