summaryrefslogtreecommitdiff
path: root/src/transports/smart_protocol.c
diff options
context:
space:
mode:
authorEtienne Samson <samson.etienne@gmail.com>2018-04-11 19:03:57 +0000
committerEtienne Samson <samson.etienne@gmail.com>2018-04-11 21:13:39 +0200
commit32586d5e1002536fc3b4eee5ee40f2efb0038e91 (patch)
treed3b6816f329141170b996f4917a753cff13e152c /src/transports/smart_protocol.c
parent01381149edaef9f8ae2872899419464160b5f877 (diff)
downloadlibgit2-32586d5e1002536fc3b4eee5ee40f2efb0038e91.tar.gz
smart: separate error handling from pkt handling
Diffstat (limited to 'src/transports/smart_protocol.c')
-rw-r--r--src/transports/smart_protocol.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c
index 2dab615af..a1b56da8d 100644
--- a/src/transports/smart_protocol.c
+++ b/src/transports/smart_protocol.c
@@ -397,10 +397,10 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
if ((error = store_common(t)) < 0)
goto on_error;
} else {
- error = recv_pkt(NULL, &pkt_type, buf);
- if (error < 0) {
+ if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
goto on_error;
- } else if (pkt_type == GIT_PKT_ACK) {
+
+ if (pkt_type == GIT_PKT_ACK) {
break;
} else if (pkt_type == GIT_PKT_NAK) {
continue;
@@ -469,11 +469,10 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
/* Now let's eat up whatever the server gives us */
if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
- error = recv_pkt(NULL, &pkt_type, buf);
-
- if (error < 0) {
+ if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
return error;
- } else if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
+
+ if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
giterr_set(GITERR_NET, "Unexpected pkt type");
return -1;
}