From: Eric Sunshine Date: Fri, 05 Feb 2016 04:03:58 GMT Subject: Re: [PATCH v2 12/25] fetch-pack: use a common function for verbose printing Message-ID: In-Reply-To: <1454576641-29615-13-git-send-email-pclouds@gmail.com> On Thu, Feb 4, 2016 at 4:03 AM, Nguyễn Thái Ngọc Duy wrote: > This reduces the number of "if (verbose)" which makes it a bit easier > to read imo. It also makes it easier to redirect all these printouts, > to a file for example. > > Signed-off-by: Nguyễn Thái Ngọc Duy > --- > diff --git a/fetch-pack.c b/fetch-pack.c > @@ -810,39 +814,32 @@ static struct ref *do_fetch_pack(struct fetch_pack_args *args, > else if (server_supports("side-band")) { > - if (args->verbose) > - fprintf(stderr, "Server supports side-band\n"); > + print_verbose(args, "Server supports side-band"); > use_sideband = 1; > } > if (server_supports("allow-tip-sha1-in-want")) { > - if (args->verbose) > - fprintf(stderr, "Server supports allow-tip-sha1-in-want\n"); > + print_verbose(args, "Server supports allow-tip-sha1-in-want"); > allow_unadvertised_object_request |= ALLOW_TIP_SHA1; > } > if (server_supports("allow-reachable-sha1-in-want")) { > - if (args->verbose) > - fprintf(stderr, "Server supports allow-reachable-sha1-in-want\n"); > + print_verbose(args, "Server supports allow-reachable-sha1-in-want\n"); I think you want to drop the newline here as you did with all the other call-sites since print_verbose() adds its own. > allow_unadvertised_object_request |= ALLOW_REACHABLE_SHA1; > } > if (!server_supports("thin-pack"))