Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVicent Martí <vicent@github.com>2013-05-31 14:09:38 +0400
committerVicent Martí <vicent@github.com>2013-05-31 14:09:38 +0400
commit9afc59710ebfd63f0265aec79bc5388e610935a1 (patch)
tree6236ff7246494726a699cc1f6ca055d05c864551 /tests-clar/refs
parentaf2c72d228eab2d380d47cb7a5c19ba562340429 (diff)
parent4f2eb2b7f4cf6b2b6594887edd8948cb149c8052 (diff)
Merge pull request #1559 from carlosmn/ref-shorthand
Introduce git_reference_shorthand
Diffstat (limited to 'tests-clar/refs')
-rw-r--r--tests-clar/refs/shorthand.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests-clar/refs/shorthand.c b/tests-clar/refs/shorthand.c
new file mode 100644
index 000000000..f995d26ca
--- /dev/null
+++ b/tests-clar/refs/shorthand.c
@@ -0,0 +1,27 @@
+#include "clar_libgit2.h"
+
+#include "repository.h"
+
+void assert_shorthand(git_repository *repo, const char *refname, const char *shorthand)
+{
+ git_reference *ref;
+
+ cl_git_pass(git_reference_lookup(&ref, repo, refname));
+ cl_assert_equal_s(git_reference_shorthand(ref), shorthand);
+ git_reference_free(ref);
+}
+
+void test_refs_shorthand__0(void)
+{
+ git_repository *repo;
+
+ cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
+
+
+ assert_shorthand(repo, "refs/heads/master", "master");
+ assert_shorthand(repo, "refs/tags/test", "test");
+ assert_shorthand(repo, "refs/remotes/test/master", "test/master");
+ assert_shorthand(repo, "refs/notes/fanout", "notes/fanout");
+
+ git_repository_free(repo);
+}