Skip to content

Commit bd2c86e

Browse files
peffgitster
authored andcommitted
make "git push -v" actually verbose
Providing a single "-v" to "git push" currently does nothing. Giving two flags ("git push -v -v") turns on the first level of verbosity. This is caused by a regression introduced in 8afd8dc (push: support multiple levels of verbosity, 2010-02-24). Before the series containing 8afd8dc, the verbosity handling for fetching and pushing was completely separate. Commit bde873c refactored the verbosity handling out of the fetch side, and then 8afd8dc converted push to use the refactored code. However, the fetch and push sides numbered and passed along their verbosity levels differently. For both, a verbosity level of "-1" meant "quiet", and "0" meant "default output". But from there they differed. For fetch, a verbosity level of "1" indicated to the "fetch" program that it should make the status table slightly more verbose, showing up-to-date entries. A verbosity level of "2" meant that we should pass a verbose flag to the transport; in the case of fetch-pack, this displays protocol debugging information. As a result, the refactored code in bde873c checks for "verbosity >= 2", and only then passes it on to the transport. From the transport code's perspective, a verbosity of 0 or 1 both meant "0". Push, on the other hand, does not show its own status table; that is always handled by the transport layer or below (originally send-pack itself, but these days it is done by the transport code). So a verbosity level of 1 meant that we should pass the verbose flag to send-pack, so that it knows we want a verbose status table. However, once 8afd8dc switched it to the refactored fetch code, a verbosity level of 1 was now being ignored. Thus, you needed to artificially bump the verbosity to 2 (via "-v -v") to have any effect. We can fix this by letting the transport code know about the true verbosity level (i.e., let it distinguish level 0 or 1). We then have to also make an adjustment to any transport methods that assumed "verbose > 0" meant they could spew lots of debugging information. Before, they could only get "0" or "2", but now they will also receive "1". They need to adjust their condition for turning on such spew from "verbose > 0" to "verbose > 1". Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 15b7898 commit bd2c86e

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

transport.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ static struct ref *get_refs_via_rsync(struct transport *transport, int for_push)
214214
rsync.argv = args;
215215
rsync.stdout_to_stderr = 1;
216216
args[0] = "rsync";
217-
args[1] = (transport->verbose > 0) ? "-rv" : "-r";
217+
args[1] = (transport->verbose > 1) ? "-rv" : "-r";
218218
args[2] = buf.buf;
219219
args[3] = temp_dir.buf;
220220
args[4] = NULL;
@@ -267,7 +267,7 @@ static int fetch_objs_via_rsync(struct transport *transport,
267267
rsync.argv = args;
268268
rsync.stdout_to_stderr = 1;
269269
args[0] = "rsync";
270-
args[1] = (transport->verbose > 0) ? "-rv" : "-r";
270+
args[1] = (transport->verbose > 1) ? "-rv" : "-r";
271271
args[2] = "--ignore-existing";
272272
args[3] = "--exclude";
273273
args[4] = "info";
@@ -350,7 +350,7 @@ static int rsync_transport_push(struct transport *transport,
350350
args[i++] = "-a";
351351
if (flags & TRANSPORT_PUSH_DRY_RUN)
352352
args[i++] = "--dry-run";
353-
if (transport->verbose > 0)
353+
if (transport->verbose > 1)
354354
args[i++] = "-v";
355355
args[i++] = "--ignore-existing";
356356
args[i++] = "--exclude";
@@ -525,7 +525,7 @@ static int fetch_refs_via_pack(struct transport *transport,
525525
args.lock_pack = 1;
526526
args.use_thin_pack = data->options.thin;
527527
args.include_tag = data->options.followtags;
528-
args.verbose = (transport->verbose > 0);
528+
args.verbose = (transport->verbose > 1);
529529
args.quiet = (transport->verbose < 0);
530530
args.no_progress = !transport->progress;
531531
args.depth = data->options.depth;
@@ -987,7 +987,7 @@ int transport_set_option(struct transport *transport,
987987
void transport_set_verbosity(struct transport *transport, int verbosity,
988988
int force_progress)
989989
{
990-
if (verbosity >= 2)
990+
if (verbosity >= 1)
991991
transport->verbose = verbosity <= 3 ? verbosity : 3;
992992
if (verbosity < 0)
993993
transport->verbose = -1;

0 commit comments

Comments
 (0)