Commit f5373123d2c20d2986fdee20d821816ce07819aa

Edward Thomson 2021-12-24T15:17:52

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
diff --git a/src/push.c b/src/push.c
index 3bf7ba5..a281dc9 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)