Skip to content

Commit af23445

Browse files
committed
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 <[email protected]>
1 parent b9ccf55 commit af23445

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

builtin/fetch.c

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ static int tags = TAGS_DEFAULT, unshallow;
3636
static const char *depth;
3737
static const char *upload_pack;
3838
static struct strbuf default_rla = STRBUF_INIT;
39-
static struct transport *transport;
39+
static struct transport *gtransport;
4040
static const char *submodule_prefix = "";
4141
static const char *recurse_submodules_default;
4242

@@ -95,8 +95,8 @@ static struct option builtin_fetch_options[] = {
9595

9696
static void unlock_pack(void)
9797
{
98-
if (transport)
99-
transport_unlock_pack(transport);
98+
if (gtransport)
99+
transport_unlock_pack(gtransport);
100100
}
101101

102102
static void unlock_pack_on_signal(int signo)
@@ -818,13 +818,13 @@ static int do_fetch(struct transport *transport,
818818

819819
static void set_option(const char *name, const char *value)
820820
{
821-
int r = transport_set_option(transport, name, value);
821+
int r = transport_set_option(gtransport, name, value);
822822
if (r < 0)
823823
die(_("Option \"%s\" value \"%s\" is not valid for %s"),
824-
name, value, transport->url);
824+
name, value, gtransport->url);
825825
if (r > 0)
826826
warning(_("Option \"%s\" is ignored for %s\n"),
827-
name, transport->url);
827+
name, gtransport->url);
828828
}
829829

830830
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)
949949
die(_("No remote repository specified. Please, specify either a URL or a\n"
950950
"remote name from which new revisions should be fetched."));
951951

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);
954954
if (upload_pack)
955955
set_option(TRANS_OPT_UPLOADPACK, upload_pack);
956956
if (keep)
@@ -983,10 +983,10 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
983983
sigchain_push_common(unlock_pack_on_signal);
984984
atexit(unlock_pack);
985985
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);
987987
free_refspec(ref_nr, refspec);
988-
transport_disconnect(transport);
989-
transport = NULL;
988+
transport_disconnect(gtransport);
989+
gtransport = NULL;
990990
return exit_code;
991991
}
992992

0 commit comments

Comments
 (0)