Commit 9bf56c7b1cee1b0ed88bd327609250f4f34314c7

Sebastian Bauer 2013-01-15T21:39:37

Don't segfault if transport doesn't support push. Instead, set an more informative error message.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/src/push.c b/src/push.c
index 7122364..452ead4 100644
--- a/src/push.c
+++ b/src/push.c
@@ -369,6 +369,12 @@ static int do_push(git_push *push)
 	int error;
 	git_transport *transport = push->remote->transport;
 
+	if (!transport->push) {
+		giterr_set(GITERR_NET, "Remote transport doesn't support push");
+		error = -1;
+		goto on_error;
+	}
+
 	/*
 	 * A pack-file MUST be sent if either create or update command
 	 * is used, even if the server already has all the necessary