Allow programs to not depend on remotes having urls
For fetch and ls-remote, which use the first url of a remote, have transport_get() determine this by passing a remote and passing NULL for the url. For push, which uses every url of a remote, use each url in turn if there are any, and use NULL if there are none. This will allow the transport code to do something different if the location is not specified with a url. Also, have the message for a fetch say "foreign" if there is no url. Signed-off-by: Daniel Barkalow <barkalow@iabervon.org> Signed-off-by: Sverre Rabbelier <srabbelier@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:

committed by
Junio C Hamano

parent
f2a37151d4
commit
fb0cc87ec0
@ -309,7 +309,10 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
|
||||
if (!fp)
|
||||
return error("cannot open %s: %s\n", filename, strerror(errno));
|
||||
|
||||
url = transport_anonymize_url(raw_url);
|
||||
if (raw_url)
|
||||
url = transport_anonymize_url(raw_url);
|
||||
else
|
||||
url = xstrdup("foreign");
|
||||
for (rm = ref_map; rm; rm = rm->next) {
|
||||
struct ref *ref = NULL;
|
||||
|
||||
@ -704,7 +707,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
|
||||
if (!remote)
|
||||
die("Where do you want to fetch from today?");
|
||||
|
||||
transport = transport_get(remote, remote->url[0]);
|
||||
transport = transport_get(remote, NULL);
|
||||
if (verbosity >= 2)
|
||||
transport->verbose = 1;
|
||||
if (verbosity < 0)
|
||||
|
Reference in New Issue
Block a user