diff options
author | Patrick Steinhardt <ps@pks.im> | 2018-07-19 08:20:04 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-07-19 08:20:04 +0000 |
commit | fa401a32d23eb832c6494db9770e6522b11f36d7 (patch) | |
tree | 1d387915b9218c60ff1f4488b1f5d3f0e5ae5c47 | |
parent | 99bb98c0e8abb97b1daa3aff0307b93ed9291c08 (diff) | |
parent | 388149f5090b6a82a9f05fb78802aa66c656dd39 (diff) | |
download | libgit2-fa401a32d23eb832c6494db9770e6522b11f36d7.tar.gz |
Merge pull request #4704 from nelhage/no-pkt-pack
Remove GIT_PKT_PACK entirely
-rw-r--r-- | src/transports/smart.h | 1 | ||||
-rw-r--r-- | src/transports/smart_pkt.c | 21 | ||||
-rw-r--r-- | src/transports/smart_protocol.c | 6 |
3 files changed, 4 insertions, 24 deletions
diff --git a/src/transports/smart.h b/src/transports/smart.h index 26bd64e22..057d7e6e0 100644 --- a/src/transports/smart.h +++ b/src/transports/smart.h @@ -40,7 +40,6 @@ typedef enum { GIT_PKT_HAVE, GIT_PKT_ACK, GIT_PKT_NAK, - GIT_PKT_PACK, GIT_PKT_COMMENT, GIT_PKT_ERR, GIT_PKT_DATA, diff --git a/src/transports/smart_pkt.c b/src/transports/smart_pkt.c index d7de5bd25..cd9ca6c92 100644 --- a/src/transports/smart_pkt.c +++ b/src/transports/smart_pkt.c @@ -86,19 +86,6 @@ static int nak_pkt(git_pkt **out) return 0; } -static int pack_pkt(git_pkt **out) -{ - git_pkt *pkt; - - pkt = git__malloc(sizeof(git_pkt)); - GITERR_CHECK_ALLOC(pkt); - - pkt->type = GIT_PKT_PACK; - *out = pkt; - - return 0; -} - static int comment_pkt(git_pkt **out, const char *line, size_t len) { git_pkt_comment *pkt; @@ -417,12 +404,12 @@ int git_pkt_parse_line( * server is trying to send us the packfile already. */ if (bufflen >= 4 && !git__prefixcmp(line, "PACK")) { - giterr_clear(); - *out = line; - return pack_pkt(head); + giterr_set(GITERR_NET, "unexpected pack file"); + } else { + giterr_set(GITERR_NET, "bad packet length"); } - return (int)len; + return -1; } /* diff --git a/src/transports/smart_protocol.c b/src/transports/smart_protocol.c index b114e182b..716aa45b4 100644 --- a/src/transports/smart_protocol.c +++ b/src/transports/smart_protocol.c @@ -70,12 +70,6 @@ int git_smart__store_refs(transport_smart *t, int flushes) return -1; } - if (pkt->type == GIT_PKT_PACK) { - giterr_set(GITERR_NET, "unexpected packfile"); - git__free(pkt); - return -1; - } - if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0) return -1; |