diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2007-09-18 04:54:57 -0400 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2007-09-19 03:22:31 -0700 |
commit | ab865e6eec1f40938604b1c28a32525c1fdc7227 (patch) | |
tree | 9fc7487ddf87381861d97f81c5c9cad94ec6d7dc /transport.c | |
parent | 85682c1903a4ae776b0bf2d30d9ecd1e19689131 (diff) | |
download | git-ab865e6eec1f40938604b1c28a32525c1fdc7227.tar.gz |
Avoid printing unnecessary warnings during fetch and push
If a transport doesn't support an option we already are telling
the higher level application (fetch or push) that the option is not
valid by sending back a >0 return value from transport_set_option
so there's not a strong motivation to have the function perform the
output itself. Instead we should let the higher level application
do the output if it is necessary. This avoids always telling the
user that depth isn't supported on HTTP urls even when they did
not pass a --depth option to git-fetch.
If the user passes an option and the option value is invalid we now
properly die in git-fetch instead of just spitting out a message
and running anyway. This mimics prior behavior better where
incorrect/malformed options are not accepted by the process.
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'transport.c')
-rw-r--r-- | transport.c | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/transport.c b/transport.c index 7f94d30f95..cc76e3f59b 100644 --- a/transport.c +++ b/transport.c @@ -460,16 +460,9 @@ struct transport *transport_get(struct remote *remote, const char *url) int transport_set_option(struct transport *transport, const char *name, const char *value) { - int ret = 1; if (transport->ops->set_option) - ret = transport->ops->set_option(transport, name, value); - if (ret < 0) - fprintf(stderr, "For '%s' option %s cannot be set to '%s'\n", - transport->url, name, value); - if (ret > 0) - fprintf(stderr, "For '%s' option %s is ignored\n", - transport->url, name); - return ret; + return transport->ops->set_option(transport, name, value); + return 1; } int transport_push(struct transport *transport, |