Alex Vandiver
2009-12-06 00:00:23 UTC
Signed-off-by: Alex Vandiver <***@chmrr.net>
---
builtin-remote.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/builtin-remote.c b/builtin-remote.c
index a501939..a34006f 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -8,14 +8,14 @@
#include "refs.h"
static const char * const builtin_remote_usage[] = {
- "git remote [-v | --verbose]",
+ "git remote [-v | --verbose] [-q | --quiet]",
"git remote add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>",
"git remote rename <old> <new>",
"git remote rm <name>",
"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]",
NULL
};
@@ -58,7 +58,7 @@ static const char * const builtin_remote_update_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);
@@ -84,9 +84,12 @@ 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) {
+ if (verbosity > 0) {
argv[1] = "-v";
argv[2] = name;
+ } else if (verbosity < 0) {
+ argv[1] = "-q";
+ argv[2] = name;
}
printf("Updating %s\n", name);
if (run_command_v_opt(argv, RUN_GIT_CMD))
@@ -1236,8 +1239,10 @@ static int update(int argc, const char **argv)
if (prune)
fetch_argv[fetch_argc++] = "--prune";
- if (verbose)
+ if (verbosity > 0)
fetch_argv[fetch_argc++] = "-v";
+ if (verbosity < 0)
+ fetch_argv[fetch_argc++] = "-q";
if (argc < 2) {
fetch_argv[fetch_argc++] = "default";
} else {
@@ -1301,7 +1306,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 {
@@ -1318,7 +1323,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;
---
builtin-remote.c | 19 ++++++++++++-------
1 files changed, 12 insertions(+), 7 deletions(-)
diff --git a/builtin-remote.c b/builtin-remote.c
index a501939..a34006f 100644
--- a/builtin-remote.c
+++ b/builtin-remote.c
@@ -8,14 +8,14 @@
#include "refs.h"
static const char * const builtin_remote_usage[] = {
- "git remote [-v | --verbose]",
+ "git remote [-v | --verbose] [-q | --quiet]",
"git remote add [-t <branch>] [-m <master>] [-f] [--mirror] <name> <url>",
"git remote rename <old> <new>",
"git remote rm <name>",
"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]",
NULL
};
@@ -58,7 +58,7 @@ static const char * const builtin_remote_update_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);
@@ -84,9 +84,12 @@ 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) {
+ if (verbosity > 0) {
argv[1] = "-v";
argv[2] = name;
+ } else if (verbosity < 0) {
+ argv[1] = "-q";
+ argv[2] = name;
}
printf("Updating %s\n", name);
if (run_command_v_opt(argv, RUN_GIT_CMD))
@@ -1236,8 +1239,10 @@ static int update(int argc, const char **argv)
if (prune)
fetch_argv[fetch_argc++] = "--prune";
- if (verbose)
+ if (verbosity > 0)
fetch_argv[fetch_argc++] = "-v";
+ if (verbosity < 0)
+ fetch_argv[fetch_argc++] = "-q";
if (argc < 2) {
fetch_argv[fetch_argc++] = "default";
} else {
@@ -1301,7 +1306,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 {
@@ -1318,7 +1323,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.6.6.rc0.360.gc408
1.6.6.rc0.360.gc408