summaryrefslogtreecommitdiff
path: root/tests-clar/refs/revparse.c
diff options
context:
space:
mode:
authornulltoken <emeric.fermas@gmail.com>2012-10-18 22:25:27 +0200
committernulltoken <emeric.fermas@gmail.com>2012-10-18 23:05:33 +0200
commit5912d74c69fb1cbfcb5f57261543d8b7afcedef1 (patch)
treed311fc0f0c62ea3a8257d82e21a5bc6049c09852 /tests-clar/refs/revparse.c
parentb2b571ce0c2969bdc00bfa400d20da5cdece1dcd (diff)
downloadlibgit2-5912d74c69fb1cbfcb5f57261543d8b7afcedef1.tar.gz
revparse: properly handle refnames containing a @
Fix #994
Diffstat (limited to 'tests-clar/refs/revparse.c')
-rw-r--r--tests-clar/refs/revparse.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/tests-clar/refs/revparse.c b/tests-clar/refs/revparse.c
index 14bd9fb84..a1f0dbf2b 100644
--- a/tests-clar/refs/revparse.c
+++ b/tests-clar/refs/revparse.c
@@ -451,3 +451,37 @@ void test_refs_revparse__a_too_short_objectid_returns_EAMBIGUOUS(void)
cl_assert_equal_i(GIT_EAMBIGUOUS, result);
}
+
+void test_refs_revparse__issue_994(void)
+{
+ git_repository *repo;
+ git_reference *head, *with_at;
+ git_object *target;
+
+ repo = cl_git_sandbox_init("testrepo.git");
+
+ cl_assert_equal_i(GIT_ENOTFOUND,
+ git_revparse_single(&target, repo, "origin/bim_with_3d@11296"));
+
+ cl_assert_equal_i(GIT_ENOTFOUND,
+ git_revparse_single(&target, repo, "refs/remotes/origin/bim_with_3d@11296"));
+
+
+ cl_git_pass(git_repository_head(&head, repo));
+ cl_git_pass(git_reference_create_oid(
+ &with_at,
+ repo,
+ "refs/remotes/origin/bim_with_3d@11296",
+ git_reference_oid(head),
+ 0));
+
+ cl_git_pass(git_revparse_single(&target, repo, "origin/bim_with_3d@11296"));
+ git_object_free(target);
+
+ cl_git_pass(git_revparse_single(&target, repo, "refs/remotes/origin/bim_with_3d@11296"));
+ git_object_free(target);
+
+ git_reference_free(with_at);
+ git_reference_free(head);
+ cl_git_sandbox_cleanup();
+}