diff options
author | Junio C Hamano <gitster@pobox.com> | 2023-01-24 00:39:52 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2023-01-24 00:39:52 +0300 |
commit | ebed06a3e99b04b447356fe63acb5904acb4e123 (patch) | |
tree | fd19dbab5f2fd7366f2ea5d5cfb81dc4fecbec94 /scalar.c | |
parent | 5287319bf8c079cca6ce06231f3e25cc3b68dd34 (diff) | |
parent | 4433bd24e4acd015af9d05832c65bd6e3b097df2 (diff) |
Merge branch 'zh/scalar-progress'
"scalar" learned to give progress bar.
* zh/scalar-progress:
scalar: show progress if stderr refers to a terminal
Diffstat (limited to 'scalar.c')
-rw-r--r-- | scalar.c | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -405,7 +405,7 @@ void load_builtin_commands(const char *prefix, struct cmdnames *cmds) static int cmd_clone(int argc, const char **argv) { const char *branch = NULL; - int full_clone = 0, single_branch = 0; + int full_clone = 0, single_branch = 0, show_progress = isatty(2); struct option clone_options[] = { OPT_STRING('b', "branch", &branch, N_("<branch>"), N_("branch to checkout after clone")), @@ -500,7 +500,9 @@ static int cmd_clone(int argc, const char **argv) if (set_recommended_config(0)) return error(_("could not configure '%s'"), dir); - if ((res = run_git("fetch", "--quiet", "origin", NULL))) { + if ((res = run_git("fetch", "--quiet", + show_progress ? "--progress" : "--no-progress", + "origin", NULL))) { warning(_("partial clone failed; attempting full clone")); if (set_config("remote.origin.promisor") || @@ -509,7 +511,9 @@ static int cmd_clone(int argc, const char **argv) goto cleanup; } - if ((res = run_git("fetch", "--quiet", "origin", NULL))) + if ((res = run_git("fetch", "--quiet", + show_progress ? "--progress" : "--no-progress", + "origin", NULL))) goto cleanup; } |