Skip to content

Commit 895a668

Browse files
committed
Small style tweak, and set an error
1 parent 90cf860 commit 895a668

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/transports/smart_pkt.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -394,7 +394,17 @@ int git_pkt_parse_line(
394394

395395
len = parse_len(line);
396396
if (len < 0) {
397-
return GIT_ERROR;
397+
/*
398+
* If we fail to parse the length, it might be because the
399+
* server is trying to send us the packfile already.
400+
*/
401+
if (bufflen >= 4 && !git__prefixcmp(line, "PACK")) {
402+
giterr_set(GITERR_NET, "unexpected pack file");
403+
} else {
404+
giterr_set(GITERR_NET, "bad packet length");
405+
}
406+
407+
return -1;
398408
}
399409

400410
/*

0 commit comments

Comments
 (0)