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 <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Tay Ray Chuan 2010-02-24 20:50:28 +08:00 committed by Junio C Hamano
parent 7838106925
commit 9839018e87
4 changed files with 18 additions and 5 deletions

View File

@ -78,9 +78,16 @@ ifndef::git-pull[]
-q:: -q::
--quiet:: --quiet::
Pass --quiet to git-fetch-pack and silence any other internally Pass --quiet to git-fetch-pack and silence any other internally
used git commands. used git commands. Progress is not reported to the standard error
stream.
-v:: -v::
--verbose:: --verbose::
Be verbose. Be verbose.
endif::git-pull[] endif::git-pull[]
--progress::
Progress status is reported on the standard error stream
by default when it is attached to a terminal, unless -q
is specified. This flag forces progress status even if the
standard error stream is not directed to a terminal.

View File

@ -33,7 +33,9 @@ OPTIONS
-q:: -q::
--quiet:: --quiet::
Pass --quiet to git-fetch and git-merge. This is passed to both underlying git-fetch to squelch reporting of
during transfer, and underlying git-merge to squelch output during
merging.
-v:: -v::
--verbose:: --verbose::

View File

@ -27,6 +27,7 @@ enum {
}; };
static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity; static int all, append, dry_run, force, keep, multiple, prune, update_head_ok, verbosity;
static int progress;
static int tags = TAGS_DEFAULT; static int tags = TAGS_DEFAULT;
static const char *depth; static const char *depth;
static const char *upload_pack; static const char *upload_pack;
@ -56,6 +57,7 @@ static struct option builtin_fetch_options[] = {
OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"), OPT_BOOLEAN('k', "keep", &keep, "keep downloaded pack"),
OPT_BOOLEAN('u', "update-head-ok", &update_head_ok, OPT_BOOLEAN('u', "update-head-ok", &update_head_ok,
"allow updating of HEAD ref"), "allow updating of HEAD ref"),
OPT_BOOLEAN(0, "progress", &progress, "force progress reporting"),
OPT_STRING(0, "depth", &depth, "DEPTH", OPT_STRING(0, "depth", &depth, "DEPTH",
"deepen history of shallow clone"), "deepen history of shallow clone"),
OPT_END() OPT_END()
@ -823,7 +825,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
die("Where do you want to fetch from today?"); die("Where do you want to fetch from today?");
transport = transport_get(remote, NULL); transport = transport_get(remote, NULL);
transport_set_verbosity(transport, verbosity, 0); transport_set_verbosity(transport, verbosity, progress);
if (upload_pack) if (upload_pack)
set_option(TRANS_OPT_UPLOADPACK, upload_pack); set_option(TRANS_OPT_UPLOADPACK, upload_pack);
if (keep) if (keep)

View File

@ -38,7 +38,7 @@ test -z "$(git ls-files -u)" || die_conflict
test -f "$GIT_DIR/MERGE_HEAD" && die_merge test -f "$GIT_DIR/MERGE_HEAD" && die_merge
strategy_args= diffstat= no_commit= squash= no_ff= ff_only= strategy_args= diffstat= no_commit= squash= no_ff= ff_only=
log_arg= verbosity= log_arg= verbosity= progress=
merge_args= merge_args=
curr_branch=$(git symbolic-ref -q HEAD) curr_branch=$(git symbolic-ref -q HEAD)
curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||") curr_branch_short=$(echo "$curr_branch" | sed "s|refs/heads/||")
@ -50,6 +50,8 @@ do
verbosity="$verbosity -q" ;; verbosity="$verbosity -q" ;;
-v|--verbose) -v|--verbose)
verbosity="$verbosity -v" ;; verbosity="$verbosity -v" ;;
--progress)
progress=--progress ;;
-n|--no-stat|--no-summary) -n|--no-stat|--no-summary)
diffstat=--no-stat ;; diffstat=--no-stat ;;
--stat|--summary) --stat|--summary)
@ -214,7 +216,7 @@ test true = "$rebase" && {
done done
} }
orig_head=$(git rev-parse -q --verify HEAD) orig_head=$(git rev-parse -q --verify HEAD)
git fetch $verbosity --update-head-ok "$@" || exit 1 git fetch $verbosity $progress --update-head-ok "$@" || exit 1
curr_head=$(git rev-parse -q --verify HEAD) curr_head=$(git rev-parse -q --verify HEAD)
if test -n "$orig_head" && test "$curr_head" != "$orig_head" if test -n "$orig_head" && test "$curr_head" != "$orig_head"