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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Add --quiet option for git-remote, which it will pass on to git-fetch.

Signed-off-by: Zefram <zefram@xxxxxxxx>
---

Tay Ray Chuan <rctay89@xxxxxxxxx> wrote:
>Signed-off-by?
>
>  http://github.com/git/git/blob/master/Documentation/SubmittingPatches

Bah, sorry, I hadn't noticed that document.  That's what I get for
jumping in quickly.

Since I'm writing an epigram now, I might as well throw in some context.
I'm a new git user, only been using it seriously for the past few days,
so I've been inhaling a lot of documentation.  I found just a handful of
small annoyances.  Upon checking out git.git, it turned out that most
of them had already been fixed, such as "git fetch --quiet" not really
being quiet.  (I was using git 1.5.6.5, via Debian lenny.)  The only
one that was left was "git remote update" not having a --quiet option.
Hence the patch.

 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.5.6.5

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]