summaryrefslogtreecommitdiff
path: root/tests/refs/shorthand.c
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2013-11-20 12:54:24 +0100
committerVicent Marti <tanoku@gmail.com>2013-11-20 12:54:24 +0100
commit4b0a36e881506a02b43a4ae3c19c93c919b36eeb (patch)
tree026182fa30273a4c1649928b6db3fc5335bd1ea4 /tests/refs/shorthand.c
parent29d7242b1dcd1f09a63417abd648a6217b85d301 (diff)
parent43cb8b32428b1b29994874349ec22eb5372e152c (diff)
downloadlibgit2-4b0a36e881506a02b43a4ae3c19c93c919b36eeb.tar.gz
Merge branch 'development'
Diffstat (limited to 'tests/refs/shorthand.c')
-rw-r--r--tests/refs/shorthand.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/refs/shorthand.c b/tests/refs/shorthand.c
new file mode 100644
index 000000000..f995d26ca
--- /dev/null
+++ b/tests/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);
+}