@matheusbsbs / matheus-bagliano / commits / 9f9aa76130
Fork 0

upload-pack: Improve error message when bad ref requested

When printing an error message saying a ref was requested that we do not have, only print that ref, rather than the ref and everything sent to us on the same packet line (e.g. protocol support specifications). Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Elijah Newren committed Jul 31, 2010 at 14:11 UTC 9f9aa761305e909aca9a46ccb33a5872b36bcb8e
2 files changed +11 -1
t/t5530-upload-pack-error.sh
+9
@@ -60,6 +60,15 @@ test_expect_success 'upload-pack fails due to error in rev-list' '
60 grep "bad tree object" output.err
61 '
62
63 +test_expect_success 'upload-pack error message when bad ref requested' '
64 +
65 + printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
66 + "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input &&
67 + test_must_fail git upload-pack . <input >output 2>output.err &&
68 + grep -q "not our ref" output.err &&
69 + ! grep -q multi_ack_detailed output.err
70 +'
71 +
72 test_expect_success 'upload-pack fails due to error in pack-objects enumeration' '
73
74 printf "0032want %s\n00000009done\n0000" \
upload-pack.c
+2 -1
@@ -549,7 +549,8 @@ static void receive_needs(void)
549 */
550 o = lookup_object(sha1_buf);
551 if (!o || !(o->flags & OUR_REF))
552 - die("git upload-pack: not our ref %s", line+5);
552 + die("git upload-pack: not our ref %s",
553 + sha1_to_hex(sha1_buf));
554 if (!(o->flags & WANTED)) {
555 o->flags |= WANTED;
556 add_object_array(o, NULL, &want_obj);