]> git.proxmox.com Git - libgit2.git/blob - tests/refs/shorthand.c
f995d26cac79d2f5171efbc9f71198cc4d55708d
[libgit2.git] / tests / refs / shorthand.c
1 #include "clar_libgit2.h"
2
3 #include "repository.h"
4
5 void assert_shorthand(git_repository *repo, const char *refname, const char *shorthand)
6 {
7 git_reference *ref;
8
9 cl_git_pass(git_reference_lookup(&ref, repo, refname));
10 cl_assert_equal_s(git_reference_shorthand(ref), shorthand);
11 git_reference_free(ref);
12 }
13
14 void test_refs_shorthand__0(void)
15 {
16 git_repository *repo;
17
18 cl_git_pass(git_repository_open(&repo, cl_fixture("testrepo.git")));
19
20
21 assert_shorthand(repo, "refs/heads/master", "master");
22 assert_shorthand(repo, "refs/tags/test", "test");
23 assert_shorthand(repo, "refs/remotes/test/master", "test/master");
24 assert_shorthand(repo, "refs/notes/fanout", "notes/fanout");
25
26 git_repository_free(repo);
27 }