aboutsummaryrefslogtreecommitdiff
path: root/t/t1400-update-ref.sh
diff options
context:
space:
mode:
authorMichael Haggerty <mhagger@alum.mit.edu>2014-04-07 15:48:06 +0200
committerJunio C Hamano <gitster@pobox.com>2014-04-07 12:09:13 -0700
commit1fbd504942b20a541ba4fcbe90d3ea21b03717e4 (patch)
tree1acd90994d3b2cbb31c4e1d95b5960f8ee7e2a2f /t/t1400-update-ref.sh
parent3afcc4637452100c68b469de7757dd2b45b4d29c (diff)
downloadgit-1fbd504942b20a541ba4fcbe90d3ea21b03717e4.tar.gz
git-1fbd504942b20a541ba4fcbe90d3ea21b03717e4.tar.xz
update-ref --stdin -z: deprecate interpreting the empty string as zeros
In the original version of this command, for the single case of the "update" command's <newvalue>, the empty string was interpreted as being equivalent to 40 "0"s. This shorthand is unnecessary (binary input will usually be generated programmatically anyway), and it complicates the parser and the documentation. So gently deprecate this usage: remove its description from the documentation and emit a warning if it is found. But for reasons of backwards compatibility, continue to accept it. Helped-by: Brad King <brad.king@kitware.com> 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.sh5
1 files changed, 3 insertions, 2 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh
index 15f5bfd16..2d61cceb4 100755
--- a/t/t1400-update-ref.sh
+++ b/t/t1400-update-ref.sh
@@ -730,10 +730,11 @@ test_expect_success 'stdin -z fails update with bad ref name' '
grep "fatal: invalid ref format: ~a" err
'
-test_expect_success 'stdin -z treats empty new value as zeros' '
+test_expect_success 'stdin -z emits warning with empty new value' '
git update-ref $a $m &&
printf $F "update $a" "" "" >stdin &&
- git update-ref -z --stdin <stdin &&
+ git update-ref -z --stdin <stdin 2>err &&
+ grep "warning: update $a: missing <newvalue>, treating as zero" err &&
test_must_fail git rev-parse --verify -q $a
'