Skip to content

Commit 82154e5

Browse files
committed
remote functions: return an int
Stop returning a void for functions, future-proofing them to allow them to fail.
1 parent 3351506 commit 82154e5

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

include/git2/remote.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,17 +378,19 @@ GIT_EXTERN(int) git_remote_connected(const git_remote *remote);
378378
* the operation has been cancelled and if so stops the operation.
379379
*
380380
* @param remote the remote
381+
* @return 0 on success, or an error code
381382
*/
382-
GIT_EXTERN(void) git_remote_stop(git_remote *remote);
383+
GIT_EXTERN(int) git_remote_stop(git_remote *remote);
383384

384385
/**
385386
* Disconnect from the remote
386387
*
387388
* Close the connection to the remote.
388389
*
389390
* @param remote the remote to disconnect from
391+
* @return 0 on success, or an error code
390392
*/
391-
GIT_EXTERN(void) git_remote_disconnect(git_remote *remote);
393+
GIT_EXTERN(int) git_remote_disconnect(git_remote *remote);
392394

393395
/**
394396
* Free the memory associated with a remote

src/remote.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1676,20 +1676,24 @@ int git_remote_connected(const git_remote *remote)
16761676
return remote->transport->is_connected(remote->transport);
16771677
}
16781678

1679-
void git_remote_stop(git_remote *remote)
1679+
int git_remote_stop(git_remote *remote)
16801680
{
16811681
assert(remote);
16821682

16831683
if (remote->transport && remote->transport->cancel)
16841684
remote->transport->cancel(remote->transport);
1685+
1686+
return 0;
16851687
}
16861688

1687-
void git_remote_disconnect(git_remote *remote)
1689+
int git_remote_disconnect(git_remote *remote)
16881690
{
16891691
assert(remote);
16901692

16911693
if (git_remote_connected(remote))
16921694
remote->transport->close(remote->transport);
1695+
1696+
return 0;
16931697
}
16941698

16951699
void git_remote_free(git_remote *remote)

0 commit comments

Comments
 (0)