summaryrefslogtreecommitdiff
path: root/t/t1400-update-ref.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-04-07 15:48:05 +0200
committerJunio C Hamano <gitster@pobox.com>2014-04-07 12:09:13 -0700
commit3afcc4637452100c68b469de7757dd2b45b4d29c (patch)
treea807097b5fffd560f9dd598745e7264d29a60fd1 /t/t1400-update-ref.sh
parent191f241b528c10e242d045bde2cef70fb013a6e5 (diff)
downloadgit-3afcc4637452100c68b469de7757dd2b45b4d29c.tar.gz
update-ref.c: extract a new function, parse_next_sha1()
Replace three functions, update_store_new_sha1(), update_store_old_sha1(), and parse_next_arg(), with a single function, parse_next_sha1(). The new function takes care of a whole argument, including checking whether it is there, converting it to an SHA-1, and emitting errors on EOF or for invalid values. The return value indicates whether the argument was present or absent, which requires a bit of intelligence because absent values are represented differently depending on whether "-z" was used. The new interface means that the calling functions, parse_cmd_*(), don't have to interpret the result differently based on the line_termination mode that is in effect. It also means that parse_cmd_create() can distinguish unambiguously between an empty new value and a zeros new value, which fixes a failure in t1400. 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.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 208f56e518..15f5bfd168 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -858,7 +858,7 @@ test_expect_success 'stdin -z create ref fails with bad new value' '
test_must_fail git rev-parse --verify -q $c
'
-test_expect_failure 'stdin -z create ref fails with empty new value' '
+test_expect_success 'stdin -z create ref fails with empty new value' '
printf $F "create $c" "" >stdin &&
test_must_fail git update-ref -z --stdin <stdin 2>err &&
grep "fatal: create $c missing <newvalue>" err &&