summaryrefslogtreecommitdiff
path: root/t/t1400-update-ref.sh
diff options
context:
space:
mode:
authorLibravatar Michael Haggerty <mhagger@alum.mit.edu>2014-04-07 15:47:54 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2014-04-07 12:09:11 -0700
commit697a41519b0d41c1b2c5714b5558f68814d78885 (patch)
tree3abb559b6f6bb471be1f6a466c8012848eadd66e /t/t1400-update-ref.sh
parentt1400: provide more usual input to the command (diff)
downloadtgif-697a41519b0d41c1b2c5714b5558f68814d78885.tar.xz
parse_arg(): really test that argument is properly terminated
The old parse_arg(), when fed an argument "refs/heads/a"master parsed 'refs/heads/a' off of the front of the argument and considered itself successful. It was only when parse_next_arg() tried to parse the *next* argument that a problem was noticed. But in fact, the definition of the input format requires arguments to be terminated by SP or NUL, so *this* argument is already erroneous and parse_arg() should diagnose the problem. So teach parse_arg() to verify that C-quoted arguments are terminated correctly. If not, emit a more specific error message. There is no corresponding error case of a non-C-quoted argument that is not terminated correctly, because the end of a non-quoted argument is *by definition* a space or NUL, so there is no way to insert other junk between the "end" of the argument and the argument terminator. Adjust the tests to expect the new error message. Add a docstring to the function, incorporating the comments that were formerly within the function plus some added information. Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't/t1400-update-ref.sh')
-rwxr-xr-xt/t1400-update-ref.sh4
1 files changed, 2 insertions, 2 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 29391c67fc..774f8c5bf1 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -356,10 +356,10 @@ test_expect_success 'stdin fails on badly quoted input' '
grep "fatal: badly quoted argument: \\\"master" err
'
-test_expect_success 'stdin fails on arguments not separated by space' '
+test_expect_success 'stdin fails on junk after quoted argument' '
echo "create \"$a\"master" >stdin &&
test_must_fail git update-ref --stdin <stdin 2>err &&
- grep "fatal: expected SP but got: master" err
+ grep "fatal: unexpected character after quoted argument: \\\"$a\\\"master" err
'
test_expect_success 'stdin fails create with no ref' '