summaryrefslogtreecommitdiff
path: root/parse-options.c
diff options
context:
space:
mode:
authorTuncer Ayaz <tuncer.ayaz@gmail.com>2008-11-15 01:14:24 +0100
committerJunio C Hamano <gitster@pobox.com>2008-11-14 17:18:32 -0800
commit7f87aff22c0232a5ce327ea3d2923776936c97f4 (patch)
treee7fe32985b21b731d159fb6f73768fc09d1d63af /parse-options.c
parenta0d3ab9c277f1a198ec8e29432c0127d4cf719d2 (diff)
downloadgit-7f87aff22c0232a5ce327ea3d2923776936c97f4.tar.gz
Teach/Fix pull/fetch -q/-v options
Implement git-pull --quiet and git-pull --verbose by adding the options to git-pull and fixing verbosity handling in git-fetch. Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'parse-options.c')
-rw-r--r--parse-options.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/parse-options.c b/parse-options.c
index fd08bb425c..9eb55cc8b5 100644
--- a/parse-options.c
+++ b/parse-options.c
@@ -484,6 +484,28 @@ int parse_opt_approxidate_cb(const struct option *opt, const char *arg,
return 0;
}
+int parse_opt_verbosity_cb(const struct option *opt, const char *arg,
+ int unset)
+{
+ int *target = opt->value;
+
+ if (unset)
+ /* --no-quiet, --no-verbose */
+ *target = 0;
+ else if (opt->short_name == 'v') {
+ if (*target >= 0)
+ (*target)++;
+ else
+ *target = 1;
+ } else {
+ if (*target <= 0)
+ (*target)--;
+ else
+ *target = -1;
+ }
+ return 0;
+}
+
/*
* This should really be OPTION_FILENAME type as a part of
* parse_options that take prefix to do this while parsing.