fetch: refactor verbosity option handling into transport.[ch]
[gitweb.git] / builtin-fetch.c
index 5b7db616dcf5cc3bb178b2c4dbb989322c6b2374..d23ea2a53e89b03418067d553a7c9e98ea2ed050 100644 (file)
@@ -322,7 +322,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;
 
@@ -819,11 +822,8 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
        if (!remote)
                die("Where do you want to fetch from today?");
 
-       transport = transport_get(remote, remote->url[0]);
-       if (verbosity >= 2)
-               transport->verbose = verbosity <= 3 ? verbosity : 3;
-       if (verbosity < 0)
-               transport->verbose = -1;
+       transport = transport_get(remote, NULL);
+       transport_set_verbosity(transport, verbosity);
        if (upload_pack)
                set_option(TRANS_OPT_UPLOADPACK, upload_pack);
        if (keep)