Skip to content

Commit cab1b01

Browse files
committed
Merge branch 'tc/maint-transport-ls-remote-with-void'
* tc/maint-transport-ls-remote-with-void: transport: add got_remote_refs flag
2 parents db3df36 + b0d66e1 commit cab1b01

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

transport.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -918,6 +918,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
918918
if (!remote)
919919
die("No remote provided to transport_get()");
920920

921+
ret->got_remote_refs = 0;
921922
ret->remote = remote;
922923
helper = remote->foreign_vcs;
923924

@@ -1079,8 +1080,10 @@ int transport_push(struct transport *transport,
10791080

10801081
const struct ref *transport_get_remote_refs(struct transport *transport)
10811082
{
1082-
if (!transport->remote_refs)
1083+
if (!transport->got_remote_refs) {
10831084
transport->remote_refs = transport->get_refs_list(transport, 0);
1085+
transport->got_remote_refs = 1;
1086+
}
10841087

10851088
return transport->remote_refs;
10861089
}

transport.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ struct transport {
1919
void *data;
2020
const struct ref *remote_refs;
2121

22+
/**
23+
* Indicates whether we already called get_refs_list(); set by
24+
* transport.c::transport_get_remote_refs().
25+
*/
26+
unsigned got_remote_refs : 1;
27+
2228
/**
2329
* Returns 0 if successful, positive if the option is not
2430
* recognized or is inapplicable, and negative if the option

0 commit comments

Comments
 (0)