Subject: [PATCH] Support "git remote --quiet update"

From: Zefram <[email-masked]>
Date: Thu, 15 Apr 2010 23:11:16 +0100

Add --quiet option for git-remote, which it will pass on to git-fetch.
---
 Documentation/git-remote.txt |    9 ++++++++-
 builtin/remote.c             |   16 ++++++++--------
 2 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/Documentation/git-remote.txt b/Documentation/git-remote.txt
index 3fc599c..25f6c05 100644
--- a/Documentation/git-remote.txt
+++ b/Documentation/git-remote.txt
@@ -19,7 +19,8 @@ SYNOPSIS
 'git remote set-url --delete' [--push] <name> <url>
 'git remote' [-v | --verbose] 'show' [-n] <name>
 'git remote prune' [-n | --dry-run] <name>
-'git remote' [-v | --verbose] 'update' [-p | --prune] [group | remote]...
+'git remote' [-v | --verbose] [-q | --quiet] 'update'
+	     [-p | --prune] [group | remote]...
 
 DESCRIPTION
 -----------
@@ -30,6 +31,12 @@ Manage the set of repositories ("remotes") whose branches you track.
 OPTIONS
 -------
 
+-q::
+--quiet::
+	Pass --quiet to git-fetch.  Progress is not reported to the
+	standard error stream.
+	NOTE: This must be placed between `remote` and `subcommand`.
+
 -v::
 --verbose::
 	Be a little more verbose and show remote url after name.
diff --git a/builtin/remote.c b/builtin/remote.c
index 277765b..5447780 100644
--- a/builtin/remote.c
+++ b/builtin/remote.c
@@ -15,7 +15,7 @@ static const char * const builtin_remote_usage[] = {
 	"git remote set-head <name> (-a | -d | <branch>)",
 	"git remote [-v | --verbose] show [-n] <name>",
 	"git remote prune [-n | --dry-run] <name>",
-	"git remote [-v | --verbose] update [-p | --prune] [group | remote]",
+	"git remote [-v | --verbose] [-q | --quiet] update [-p | --prune] [group | remote]",
 	"git remote set-url <name> <newurl> [<oldurl>]",
 	"git remote set-url --add <name> <newurl>",
 	"git remote set-url --delete <name> <url>",
@@ -68,7 +68,7 @@ static const char * const builtin_remote_seturl_usage[] = {
 #define GET_HEAD_NAMES (1<<1)
 #define GET_PUSH_REF_STATES (1<<2)
 
-static int verbose;
+static int verbosity;
 
 static int show_all(void);
 static int prune_remote(const char *remote, int dry_run);
@@ -94,8 +94,8 @@ static int opt_parse_track(const struct option *opt, const char *arg, int not)
 static int fetch_remote(const char *name)
 {
 	const char *argv[] = { "fetch", name, NULL, NULL };
-	if (verbose) {
-		argv[1] = "-v";
+	if (verbosity != 0) {
+		argv[1] = verbosity > 0 ? "-v" : "-q";
 		argv[2] = name;
 	}
 	printf("Updating %s\n", name);
@@ -1246,8 +1246,8 @@ static int update(int argc, const char **argv)
 
 	if (prune)
 		fetch_argv[fetch_argc++] = "--prune";
-	if (verbose)
-		fetch_argv[fetch_argc++] = "-v";
+	if (verbosity != 0)
+		fetch_argv[fetch_argc++] = verbosity > 0 ? "-v" : "-q";
 	fetch_argv[fetch_argc++] = "--multiple";
 	if (argc < 2)
 		fetch_argv[fetch_argc++] = "default";
@@ -1395,7 +1395,7 @@ static int show_all(void)
 		sort_string_list(&list);
 		for (i = 0; i < list.nr; i++) {
 			struct string_list_item *item = list.items + i;
-			if (verbose)
+			if (verbosity > 0)
 				printf("%s\t%s\n", item->string,
 					item->util ? (const char *)item->util : "");
 			else {
@@ -1412,7 +1412,7 @@ static int show_all(void)
 int cmd_remote(int argc, const char **argv, const char *prefix)
 {
 	struct option options[] = {
-		OPT_BOOLEAN('v', "verbose", &verbose, "be verbose; must be placed before a subcommand"),
+		OPT__VERBOSITY(&verbosity),
 		OPT_END()
 	};
 	int result;
-- 
1.7.1.rc1.12.ga601.dirty