Add git_remote_connected

Signed-off-by: Carlos Martín Nieto <carlos@cmartin.tk>
This commit is contained in:
Carlos Martín Nieto 2011-11-21 20:48:59 +01:00
parent 4cf01e9a1a
commit 6ac3b707b1
2 changed files with 15 additions and 0 deletions

View File

@ -123,6 +123,16 @@ GIT_EXTERN(int) git_remote_ls(git_remote *remote, git_headarray *refs);
*/
GIT_EXTERN(int) git_remote_download(char **filename, git_remote *remote);
/**
* Check whether the remote is connected
*
* Check whether the remote's underlying transport is connected to the
* remote host.
*
* @return 1 if it's connected, 0 otherwise.
*/
GIT_EXTERN(int) git_remote_connected(git_remote *remote);
/**
* Disconnect from the remote
*

View File

@ -267,6 +267,11 @@ int git_remote_update_tips(struct git_remote *remote)
return GIT_SUCCESS;
}
int git_remote_connected(git_remote *remote)
{
return remote->transport == NULL ? 0 : remote->transport->connected;
}
void git_remote_disconnect(git_remote *remote)
{
if (remote->transport != NULL) {