upload-pack: fix error message typo
authorJonathan Tan <jonathantanmy@google.com>
Wed, 2 May 2018 00:31:29 +0000 (17:31 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 2 May 2018 09:54:32 +0000 (18:54 +0900)
Fix a typo in an error message.

Also, this line was introduced in 3145ea957d2c ("upload-pack: introduce
fetch server command", 2018-03-15), which did not contain a test for the
case which causes this error to be printed, so introduce a test.

Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t5701-git-serve.sh
upload-pack.c
index 72d7bc56280b13c68b930ea41690788ad87c9853..1b4b13cc2b29ba1f2eb83b37743533b867bc5c13 100755 (executable)
@@ -173,4 +173,18 @@ test_expect_success 'symrefs parameter' '
        test_cmp actual expect
 '
 
+test_expect_success 'unexpected lines are not allowed in fetch request' '
+       git init server &&
+
+       test-pkt-line pack >in <<-EOF &&
+       command=fetch
+       0001
+       this-is-not-a-command
+       0000
+       EOF
+
+       test_must_fail git -C server serve --stateless-rpc <in >/dev/null 2>err &&
+       grep "unexpected line: .this-is-not-a-command." err
+'
+
 test_done
index 87b4d32a6e23aed2416a9bb752dfa56b916b141c..c4456bb88a83a356c741fef014a711e11200f5a7 100644 (file)
@@ -1252,7 +1252,7 @@ static void process_args(struct packet_reader *request,
                }
 
                /* ignore unknown lines maybe? */
-               die("unexpect line: '%s'", arg);
+               die("unexpected line: '%s'", arg);
        }
 }