Skip to content

Commit

Permalink
fetch: refactor verbosity option handling into transport.[ch]
Browse files Browse the repository at this point in the history
transport_set_verbosity() is now provided to transport users.

Signed-off-by: Tay Ray Chuan <rctay89@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
rctay authored and gitster committed Feb 24, 2010
1 parent 84f8851 commit bde873c
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 1 addition & 4 deletions builtin-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 8 additions & 0 deletions transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit bde873c

Please sign in to comment.