Skip to content

Commit 9839018

Browse files
rctaygitster
authored andcommitted
fetch and pull: learn --progress
Note that in the documentation for git-pull, documentation for the --progress option is displayed under the "Options related to fetching" subtitle via fetch-options.txt. Also, update the documentation of the -q/--quiet option for git-pull to mention its effect on progress reporting during fetching. Signed-off-by: Tay Ray Chuan <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 7838106 commit 9839018

File tree

4 files changed

+18
-5
lines changed

4 files changed

+18
-5
lines changed

Documentation/fetch-options.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,16 @@ ifndef::git-pull[]
7878
-q::
7979
--quiet::
8080
Pass --quiet to git-fetch-pack and silence any other internally
81-
used git commands.
81+
used git commands. Progress is not reported to the standard error
82+
stream.
8283

8384
-v::
8485
--verbose::
8586
Be verbose.
8687
endif::git-pull[]
88+
89+
--progress::
90+
Progress status is reported on the standard error stream
91+
by default when it is attached to a terminal, unless -q
92+
is specified. This flag forces progress status even if the
93+
standard error stream is not directed to a terminal.

Documentation/git-pull.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,9 @@ OPTIONS
3333

3434
-q::
3535
--quiet::
36-
Pass --quiet to git-fetch and git-merge.
36+
This is passed to both underlying git-fetch to squelch reporting of
37+
during transfer, and underlying git-merge to squelch output during
38+
merging.
3739

3840
-v::
3941
--verbose::

builtin-fetch.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ enum {
2727
};
2828

2929
static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity;
30+
static int progress;
3031
static int tags = TAGS_DEFAULT;
3132
static const char *depth;
3233
static const char *upload_pack;
@@ -56,6 +57,7 @@ static struct option builtin_fetch_options[] = {
5657
OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"),
5758
OPT_BOOLEAN('u', "update-head-ok", &update_head_ok,
5859
"allow updating of HEAD ref"),
60+
OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"),
5961
OPT_STRING(0, "depth", &depth, "DEPTH",
6062
"deepen history of shallow clone"),
6163
OPT_END()
@@ -823,7 +825,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
823825
die("Where do you want to fetch from today?");
824826

825827
transport = transport_get(remote, NULL);
826-
transport_set_verbosity(transport, verbosity, 0);
828+
transport_set_verbosity(transport, verbosity, progress);
827829
if (upload_pack)
828830
set_option(TRANS_OPT_UPLOADPACK, upload_pack);
829831
if (keep)

git-pull.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ test -z "$(git ls-files -u)" || die_conflict
3838
test -f "$GIT_DIR/MERGE_HEAD" && die_merge
3939

4040
strategy_args= diffstat= no_commit= squash= no_ff= ff_only=
41-
log_arg= verbosity=
41+
log_arg= verbosity= progress=
4242
merge_args=
4343
curr_branch=$(git symbolic-ref -q HEAD)
4444
curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
@@ -50,6 +50,8 @@ do
5050
verbosity="$verbosity -q" ;;
5151
-v|--verbose)
5252
verbosity="$verbosity -v" ;;
53+
--progress)
54+
progress=--progress ;;
5355
-n|--no-stat|--no-summary)
5456
diffstat=--no-stat ;;
5557
--stat|--summary)
@@ -214,7 +216,7 @@ test true = "$rebase" && {
214216
done
215217
}
216218
orig_head=$(git rev-parse -q --verify HEAD)
217-
git fetch $verbosity --update-head-ok "$@" || exit 1
219+
git fetch $verbosity $progress --update-head-ok "$@" || exit 1
218220

219221
curr_head=$(git rev-parse -q --verify HEAD)
220222
if test -n "$orig_head" && test "$curr_head" != "$orig_head"

0 commit comments

Comments
 (0)