Skip to content

Commit 32586d5

Browse files
committed
smart: separate error handling from pkt handling
1 parent 0138114 commit 32586d5

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/transports/smart_protocol.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,10 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
397397
if ((error = store_common(t)) < 0)
398398
goto on_error;
399399
} else {
400-
error = recv_pkt(NULL, &pkt_type, buf);
401-
if (error < 0) {
400+
if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
402401
goto on_error;
403-
} else if (pkt_type == GIT_PKT_ACK) {
402+
403+
if (pkt_type == GIT_PKT_ACK) {
404404
break;
405405
} else if (pkt_type == GIT_PKT_NAK) {
406406
continue;
@@ -469,11 +469,10 @@ int git_smart__negotiate_fetch(git_transport *transport, git_repository *repo, c
469469

470470
/* Now let's eat up whatever the server gives us */
471471
if (!t->caps.multi_ack && !t->caps.multi_ack_detailed) {
472-
error = recv_pkt(NULL, &pkt_type, buf);
473-
474-
if (error < 0) {
472+
if ((error = recv_pkt(NULL, &pkt_type, buf)) < 0)
475473
return error;
476-
} else if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
474+
475+
if (pkt_type != GIT_PKT_ACK && pkt_type != GIT_PKT_NAK) {
477476
giterr_set(GITERR_NET, "Unexpected pkt type");
478477
return -1;
479478
}

0 commit comments

Comments
 (0)