diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-07-13 15:30:23 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-07-13 18:07:10 +0400 |
commit | 80fd31faf773f3f50e2b5547b7171063f38dac17 (patch) | |
tree | f266014c6f292dcbedcc1a3cc01fcefc7f69d0b9 /tests-clar/refs | |
parent | 1662158cf98ce32827f3857fd9559a1b0e6223ed (diff) |
revparse: Don't return a reference when asked for a git object
Fix #1722
Diffstat (limited to 'tests-clar/refs')
-rw-r--r-- | tests-clar/refs/revparse.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c index 69d92745c..9657054de 100644 --- a/tests-clar/refs/revparse.c +++ b/tests-clar/refs/revparse.c @@ -738,4 +738,45 @@ void test_refs_revparse__ext_can_expand_short_reference_names(void) "master", "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", "refs/heads/master"); + + test_object_and_ref( + "HEAD", + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", + "refs/heads/master"); + + test_object_and_ref( + "tags/test", + "b25fa35b38051e4ae45d4222e795f9df2e43f1d1", + "refs/tags/test"); +} + +void test_refs_revparse__ext_returns_NULL_reference_when_expression_points_at_a_revision(void) +{ + test_object_and_ref( + "HEAD~3", + "4a202b346bb0fb0db7eff3cffeb3c70babbd2045", + NULL); + + test_object_and_ref( + "HEAD~0", + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", + NULL); + + test_object_and_ref( + "HEAD^0", + "a65fedf39aefe402d3bb6e24df4d4f5fe4547750", + NULL); + + test_object_and_ref( + "@{-1}@{0}", + "a4a7dce85cf63874e984719f4fdd239f5145052f", + NULL); +} + +void test_refs_revparse__ext_returns_NULL_reference_when_expression_points_at_a_tree_content(void) +{ + test_object_and_ref( + "tags/test:readme.txt", + "0266163a49e280c4f5ed1e08facd36a2bd716bcf", + NULL); } |