summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-12-24 15:17:52 -0600
committerEdward Thomson <ethomson@edwardthomson.com>2022-01-06 15:18:32 -0500
commitf5373123d2c20d2986fdee20d821816ce07819aa (patch)
treed81aac9b355c17036862e4a5fc46c23f758b5790
parent240c195fe5f49133ee48acd8cd12766d9d25e782 (diff)
downloadlibgit2-f5373123d2c20d2986fdee20d821816ce07819aa.tar.gz
push: don't try to connect in `finish`
Push starts by connecting, don't try to connect again, just rely on the existing connection existing.
-rw-r--r--src/push.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/push.c b/src/push.c
index 3bf7ba5d9..a281dc979 100644
--- a/src/push.c
+++ b/src/push.c
@@ -476,9 +476,10 @@ int git_push_finish(git_push *push, const git_remote_callbacks *callbacks)
{
int error;
- if (!git_remote_connected(push->remote) &&
- (error = git_remote__connect(push->remote, GIT_DIRECTION_PUSH, callbacks, &push->connection)) < 0)
- return error;
+ if (!git_remote_connected(push->remote)) {
+ git_error_set(GIT_ERROR_NET, "remote is disconnected");
+ return -1;
+ }
if ((error = filter_refs(push->remote)) < 0 ||
(error = do_push(push, callbacks)) < 0)