diff options
author | Aman Gupta <aman@tmm1.net> | 2014-04-02 10:09:54 +0200 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2014-04-02 10:40:43 -0700 |
commit | b9d56b5dd9a8819c900725b8618f8bd994a5054f (patch) | |
tree | a0193e8f5125fc9177711e01f324771b9b924516 /t | |
parent | 5f95c9f850b19b368c43ae399cc831b17a26a5ac (diff) | |
download | git-b9d56b5dd9a8819c900725b8618f8bd994a5054f.tar.gz git-b9d56b5dd9a8819c900725b8618f8bd994a5054f.tar.xz |
update-ref: fail create operation over stdin if ref already exists
Signed-off-by: Aman Gupta <aman@tmm1.net>
Signed-off-by: Michael Haggerty <mhagger@alum.mit.edu>
Acked-by: Brad King <brad.king@kitware.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 't')
-rwxr-xr-x | t/t1400-update-ref.sh | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/t/t1400-update-ref.sh b/t/t1400-update-ref.sh index 6ffd82fe3..e130c528f 100755 --- a/t/t1400-update-ref.sh +++ b/t/t1400-update-ref.sh @@ -820,7 +820,18 @@ test_expect_success 'stdin -z update ref fails with bad old value' ' test_must_fail git rev-parse --verify -q $c ' +test_expect_success 'stdin -z create ref fails when ref exists' ' + git update-ref $c $m && + git rev-parse "$c" >expect && + printf $F "create $c" "$m~1" >stdin && + test_must_fail git update-ref -z --stdin <stdin 2>err && + grep "fatal: Cannot lock the ref '"'"'$c'"'"'" err && + git rev-parse "$c" >actual && + test_cmp expect actual +' + test_expect_success 'stdin -z create ref fails with bad new value' ' + git update-ref -d "$c" && printf $F "create $c" "does-not-exist" >stdin && test_must_fail git update-ref -z --stdin <stdin 2>err && grep "fatal: invalid new value for ref $c: does-not-exist" err && |