* [PATCH] upload-pack: Improve error message when bad ref requested
@ 2010-07-31 20:11 Elijah Newren
0 siblings, 0 replies; only message in thread
From: Elijah Newren @ 2010-07-31 20:11 UTC (permalink / raw)
To: git; +Cc: gitster, Elijah Newren
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>
---
t/t5530-upload-pack-error.sh | 9 +++++++++
upload-pack.c | 3 ++-
2 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/t/t5530-upload-pack-error.sh b/t/t5530-upload-pack-error.sh
index 044603c..6b2a5f4 100755
--- a/t/t5530-upload-pack-error.sh
+++ b/t/t5530-upload-pack-error.sh
@@ -60,6 +60,15 @@ test_expect_success 'upload-pack fails due to error in rev-list' '
grep "bad tree object" output.err
'
+test_expect_success 'upload-pack error message when bad ref requested' '
+
+ printf "0045want %s multi_ack_detailed\n00000009done\n0000" \
+ "deadbeefdeadbeefdeadbeefdeadbeefdeadbeef" >input &&
+ test_must_fail git upload-pack . <input >output 2>output.err &&
+ grep -q "not our ref" output.err &&
+ ! grep -q multi_ack_detailed output.err
+'
+
test_expect_success 'upload-pack fails due to error in pack-objects enumeration' '
printf "0032want %s\n00000009done\n0000" \
diff --git a/upload-pack.c b/upload-pack.c
index dc464d7..fd1ffe1 100644
--- a/upload-pack.c
+++ b/upload-pack.c
@@ -554,7 +554,8 @@ static void receive_needs(void)
*/
o = lookup_object(sha1_buf);
if (!o || !(o->flags & OUR_REF))
- die("git upload-pack: not our ref %s", line+5);
+ die("git upload-pack: not our ref %s",
+ sha1_to_hex(sha1_buf));
if (!(o->flags & WANTED)) {
o->flags |= WANTED;
add_object_array(o, NULL, &want_obj);
--
1.7.2.1.2.g25e932.dirty
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-07-31 20:04 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-31 20:11 [PATCH] upload-pack: Improve error message when bad ref requested Elijah Newren
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).