fetch: rename file-scope global "transport" to "gtransport"

Although many functions in this file take a "struct transport" as a parameter, "fetch_one()" assigns to the global singleton instance which is a file-scope static, in order to allow a parameterless signal handler unlock_pack() to access it. Rename the variable to gtransport to make sure these uses stand out. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Junio C Hamano committed Aug 7, 2013 at 15:38 UTC af23445925464b74b5f038271b6cfeaeb217481f
1 file changed +11 -11
builtin/fetch.c
+11 -11
@@ -36,7 +36,7 @@ static int tags = TAGS_DEFAULT, unshallow;
36 static const char *depth;
37 static const char *upload_pack;
38 static struct strbuf default_rla = STRBUF_INIT;
39 -static struct transport *transport;
39 +static struct transport *gtransport;
40 static const char *submodule_prefix = "";
41 static const char *recurse_submodules_default;
42
@@ -95,8 +95,8 @@ static struct option builtin_fetch_options[] = {
95
96 static void unlock_pack(void)
97 {
98 - if (transport)
99 - transport_unlock_pack(transport);
98 + if (gtransport)
99 + transport_unlock_pack(gtransport);
100 }
101
102 static void unlock_pack_on_signal(int signo)
@@ -818,13 +818,13 @@ static int do_fetch(struct transport *transport,
818
819 static void set_option(const char *name, const char *value)
820 {
821 - int r = transport_set_option(transport, name, value);
821 + int r = transport_set_option(gtransport, name, value);
822 if (r < 0)
823 die(_("Option \"%s\" value \"%s\" is not valid for %s"),
824 - name, value, transport->url);
824 + name, value, gtransport->url);
825 if (r > 0)
826 warning(_("Option \"%s\" is ignored for %s\n"),
827 - name, transport->url);
827 + name, gtransport->url);
828 }
829
830 static int get_one_remote_for_fetch(struct remote *remote, void *priv)
@@ -949,8 +949,8 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
949 die(_("No remote repository specified. Please, specify either a URL or a\n"
950 "remote name from which new revisions should be fetched."));
951
952 - transport = transport_get(remote, NULL);
953 - transport_set_verbosity(transport, verbosity, progress);
952 + gtransport = transport_get(remote, NULL);
953 + transport_set_verbosity(gtransport, verbosity, progress);
954 if (upload_pack)
955 set_option(TRANS_OPT_UPLOADPACK, upload_pack);
956 if (keep)
@@ -983,10 +983,10 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
983 sigchain_push_common(unlock_pack_on_signal);
984 atexit(unlock_pack);
985 refspec = parse_fetch_refspec(ref_nr, refs);
986 - exit_code = do_fetch(transport, refspec, ref_nr);
986 + exit_code = do_fetch(gtransport, refspec, ref_nr);
987 free_refspec(ref_nr, refspec);
988 - transport_disconnect(transport);
989 - transport = NULL;
988 + transport_disconnect(gtransport);
989 + gtransport = NULL;
990 return exit_code;
991 }
992