t1400: add tests around adding/deleting pseudorefs
commit65eb8fc344205a4039b989f07367f345101bbf28
authorMartin Ågren <martin.agren@gmail.com>
Thu, 10 May 2018 19:29:55 +0000 (10 21:29 +0200)
committerJunio C Hamano <gitster@pobox.com>
Sun, 13 May 2018 01:36:11 +0000 (13 10:36 +0900)
tree8dbf3bf0e83a70d5acf11afea9644a92ac5113f7
parentc0bdd658bd2f06dc1c0d8fd578e80831f8d53b43
t1400: add tests around adding/deleting pseudorefs

I have not been able to find any tests around adding pseudorefs using
`git update-ref`. Add some as outlined in this table (original design by
Michael Haggerty; modified and extended by me):

Pre-update value   | ref-update old OID   | Expected result
-------------------|----------------------|----------------
missing            | value                | reject
missing            | none given           | accept
set                | none given           | accept
set                | correct value        | accept
set                | wrong value          | reject
missing            | zero                 | accept *
set                | zero                 | reject *

The tests marked with a * currently fail, despite git-update-ref(1)
claiming that it is possible to "specify 40 '0' or an empty string as
<oldvalue> to make sure that the ref you are creating does not exist."
These failing tests will be fixed in the next commit.

It is only natural to test deletion as well. Test deletion without an
old OID, with a correct one and with an incorrect one.

Suggested-by: Michael Haggerty <mhagger@alum.mit.edu>
Signed-off-by: Martin Ågren <martin.agren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t1400-update-ref.sh