Skip to content

Commit

Permalink
Merge branch 'tc/maint-transport-ls-remote-with-void'
Browse files Browse the repository at this point in the history
* tc/maint-transport-ls-remote-with-void:
  transport: add got_remote_refs flag
  • Loading branch information
Junio C Hamano committed Feb 21, 2010
2 parents db3df36 + b0d66e1 commit cab1b01
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion transport.c
Original file line number Diff line number Diff line change
Expand Up @@ -918,6 +918,7 @@ struct transport *transport_get(struct remote *remote, const char *url)
if (!remote)
die("No remote provided to transport_get()");

ret->got_remote_refs = 0;
ret->remote = remote;
helper = remote->foreign_vcs;

Expand Down Expand Up @@ -1079,8 +1080,10 @@ int transport_push(struct transport *transport,

const struct ref *transport_get_remote_refs(struct transport *transport)
{
if (!transport->remote_refs)
if (!transport->got_remote_refs) {
transport->remote_refs = transport->get_refs_list(transport, 0);
transport->got_remote_refs = 1;
}

return transport->remote_refs;
}
Expand Down
6 changes: 6 additions & 0 deletions transport.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ struct transport {
void *data;
const struct ref *remote_refs;

/**
* Indicates whether we already called get_refs_list(); set by
* transport.c::transport_get_remote_refs().
*/
unsigned got_remote_refs : 1;

/**
* Returns 0 if successful, positive if the option is not
* recognized or is inapplicable, and negative if the option
Expand Down

0 comments on commit cab1b01

Please sign in to comment.