clone: support multiple levels of verbosity
Signed-off-by: Tay Ray Chuan <rctay89@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Tay Ray Chuan committed
Feb 24, 2010 at 20:50 UTC
5bd631b3688e93ddedb33d4087deb91e2aae9e8e
1 file changed
+6
-10
builtin-clone.c
+6
-10
@@ -37,18 +37,17 @@ static const char * const builtin_clone_usage[] = {
37
NULL
38
};
39
40
-static int option_quiet, option_no_checkout, option_bare, option_mirror;
40
+static int option_no_checkout, option_bare, option_mirror;
41
static int option_local, option_no_hardlinks, option_shared, option_recursive;
42
static char *option_template, *option_reference, *option_depth;
43
static char *option_origin = NULL;
44
static char *option_branch = NULL;
45
static char *option_upload_pack = "git-upload-pack";
46
-static int option_verbose;
46
+static int option_verbosity;
47
static int option_progress;
48
49
static struct option builtin_clone_options[] = {
50
- OPT__QUIET(&option_quiet),
51
- OPT__VERBOSE(&option_verbose),
50
+ OPT__VERBOSITY(&option_verbosity),
51
OPT_BOOLEAN(0, "progress", &option_progress,
52
"force progress reporting"),
53
OPT_BOOLEAN('n', "no-checkout", &option_no_checkout,
@@ -462,7 +461,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
461
die("could not create leading directories of '%s'", git_dir);
462
set_git_dir(make_absolute_path(git_dir));
463
465
- init_db(option_template, option_quiet ? INIT_DB_QUIET : 0);
464
+ init_db(option_template, (option_verbosity < 0) ? INIT_DB_QUIET : 0);
465
466
/*
467
* At this point, the config exists, so we do not need the
@@ -526,10 +525,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
525
transport_set_option(transport, TRANS_OPT_DEPTH,
526
option_depth);
527
529
- if (option_quiet)
530
- transport->verbose = -1;
531
- else if (option_verbose)
532
- transport->verbose = 1;
528
+ transport_set_verbosity(transport, option_verbosity);
529
530
if (option_progress)
531
transport->progress = 1;
@@ -641,7 +637,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
637
opts.update = 1;
638
opts.merge = 1;
639
opts.fn = oneway_merge;
644
- opts.verbose_update = !option_quiet;
640
+ opts.verbose_update = (option_verbosity > 0);
641
opts.src_index = &the_index;
642
opts.dst_index = &the_index;
643