From: Nguyễn Thái Ngọc Duy <redacted>
pack-protocol.txt says so and fetch-pack also follows it even though
upload-pack is a bit lax. Fix it.
Signed-off-by: Stefan Beller <redacted>
---
upload-pack.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/upload-pack.c b/upload-pack.c
index e0ce2bf..d9230ba 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -558,6 +558,7 @@ static void receive_needs(void)
struct object_array shallows = OBJECT_ARRAY_INIT;
int depth = 0;
int has_non_tip = 0;
+ int first_want = 1;
shallow_nr = 0;
for (;;) {@@ -596,7 +597,11 @@ static void receive_needs(void)
die("git upload-pack: protocol error, "
"expected to get sha, not '%s'", line);
- parse_features(line + 45);
+ if (first_want) {
+ parse_features(line + 45);
+ first_want = 0;
+ } else if (line[45])
+ die("garbage at the end of 'want' line %s", line + 45);
o = parse_object(sha1_buf);
if (!o)--
2.3.0.81.gc37f363