From: Tay Ray Chuan Date: Wed, 24 Feb 2010 12:50:23 +0000 (+0800) Subject: fetch: refactor verbosity option handling into transport.[ch] X-Git-Tag: v1.7.1-rc0~66^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=bde873c;p=git.git fetch: refactor verbosity option handling into transport.[ch] transport_set_verbosity() is now provided to transport users. Signed-off-by: Tay Ray Chuan Signed-off-by: Junio C Hamano --- diff --git a/builtin-fetch.c b/builtin-fetch.c index 8654fa7a2..d23ea2a53 100644 --- a/builtin-fetch.c +++ b/builtin-fetch.c @@ -823,10 +823,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv) die("Where do you want to fetch from today?"); transport = transport_get(remote, NULL); - if (verbosity >= 2) - transport->verbose = verbosity <= 3 ? verbosity : 3; - if (verbosity < 0) - transport->verbose = -1; + transport_set_verbosity(transport, verbosity); if (upload_pack) set_option(TRANS_OPT_UPLOADPACK, upload_pack); if (keep) diff --git a/transport.c b/transport.c index 3846aacb4..1632c4d0a 100644 --- a/transport.c +++ b/transport.c @@ -1013,6 +1013,14 @@ int transport_set_option(struct transport *transport, return 1; } +void transport_set_verbosity(struct transport *transport, int verbosity) +{ + if (verbosity >= 2) + transport->verbose = verbosity <= 3 ? verbosity : 3; + if (verbosity < 0) + transport->verbose = -1; +} + int transport_push(struct transport *transport, int refspec_nr, const char **refspec, int flags, int *nonfastforward) diff --git a/transport.h b/transport.h index 7cea5cc72..7d1a0b6b3 100644 --- a/transport.h +++ b/transport.h @@ -122,6 +122,7 @@ struct transport *transport_get(struct remote *, const char *); **/ int transport_set_option(struct transport *transport, const char *name, const char *value); +void transport_set_verbosity(struct transport *transport, int verbosity); int transport_push(struct transport *connection, int refspec_nr, const char **refspec, int flags,