Skip to content

Commit fa401a3

Browse files
authored
Merge pull request libgit2#4704 from nelhage/no-pkt-pack
Remove GIT_PKT_PACK entirely
2 parents 99bb98c + 388149f commit fa401a3

File tree

3 files changed

+4
-24
lines changed

3 files changed

+4
-24
lines changed

src/transports/smart.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ typedef enum {
4040
GIT_PKT_HAVE,
4141
GIT_PKT_ACK,
4242
GIT_PKT_NAK,
43-
GIT_PKT_PACK,
4443
GIT_PKT_COMMENT,
4544
GIT_PKT_ERR,
4645
GIT_PKT_DATA,

src/transports/smart_pkt.c

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,6 @@ static int nak_pkt(git_pkt **out)
8686
return 0;
8787
}
8888

89-
static int pack_pkt(git_pkt **out)
90-
{
91-
git_pkt *pkt;
92-
93-
pkt = git__malloc(sizeof(git_pkt));
94-
GITERR_CHECK_ALLOC(pkt);
95-
96-
pkt->type = GIT_PKT_PACK;
97-
*out = pkt;
98-
99-
return 0;
100-
}
101-
10289
static int comment_pkt(git_pkt **out, const char *line, size_t len)
10390
{
10491
git_pkt_comment *pkt;
@@ -417,12 +404,12 @@ int git_pkt_parse_line(
417404
* server is trying to send us the packfile already.
418405
*/
419406
if (bufflen >= 4 && !git__prefixcmp(line, "PACK")) {
420-
giterr_clear();
421-
*out = line;
422-
return pack_pkt(head);
407+
giterr_set(GITERR_NET, "unexpected pack file");
408+
} else {
409+
giterr_set(GITERR_NET, "bad packet length");
423410
}
424411

425-
return (int)len;
412+
return -1;
426413
}
427414

428415
/*

src/transports/smart_protocol.c

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,6 @@ int git_smart__store_refs(transport_smart *t, int flushes)
7070
return -1;
7171
}
7272

73-
if (pkt->type == GIT_PKT_PACK) {
74-
giterr_set(GITERR_NET, "unexpected packfile");
75-
git__free(pkt);
76-
return -1;
77-
}
78-
7973
if (pkt->type != GIT_PKT_FLUSH && git_vector_insert(refs, pkt) < 0)
8074
return -1;
8175

0 commit comments

Comments
 (0)