diff options
author | nulltoken <emeric.fermas@gmail.com> | 2012-10-20 12:07:53 +0200 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2012-10-20 12:07:53 +0200 |
commit | cd1ef82253b5f4242ed9aed5e9abf7bceb33ec04 (patch) | |
tree | e81e65d32eef81cfb99e980ad09c6e30c2690876 /tests-clar/repo/head.c | |
parent | 209e34fa7068615b96324a4243a49b030b0c7156 (diff) | |
download | libgit2-cd1ef82253b5f4242ed9aed5e9abf7bceb33ec04.tar.gz |
test: extract make_head_orphaned() logic
Diffstat (limited to 'tests-clar/repo/head.c')
-rw-r--r-- | tests-clar/repo/head.c | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/tests-clar/repo/head.c b/tests-clar/repo/head.c index 34f3f8951..30377dc15 100644 --- a/tests-clar/repo/head.c +++ b/tests-clar/repo/head.c @@ -1,5 +1,6 @@ #include "clar_libgit2.h" #include "refs.h" +#include "repo_helpers.h" git_repository *repo; @@ -30,21 +31,13 @@ void test_repo_head__head_detached(void) cl_assert_equal_i(false, git_repository_head_detached(repo)); } -static void make_head_orphaned(void) -{ - git_reference *head; - - cl_git_pass(git_reference_create_symbolic(&head, repo, GIT_HEAD_FILE, "refs/heads/hide/and/seek", 1)); - git_reference_free(head); -} - void test_repo_head__head_orphan(void) { git_reference *ref; cl_assert(git_repository_head_orphan(repo) == 0); - make_head_orphaned(); + make_head_orphaned(repo, NON_EXISTING_HEAD); cl_assert(git_repository_head_orphan(repo) == 1); @@ -171,7 +164,7 @@ void test_repo_head__detach_head_Fails_if_HEAD_and_point_to_a_non_commitish(void void test_repo_head__detaching_an_orphaned_head_returns_GIT_EORPHANEDHEAD(void) { - make_head_orphaned(); + make_head_orphaned(repo, NON_EXISTING_HEAD); cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_detach_head(repo)); } @@ -180,7 +173,7 @@ void test_repo_head__retrieving_an_orphaned_head_returns_GIT_EORPHANEDHEAD(void) { git_reference *head; - make_head_orphaned(); + make_head_orphaned(repo, NON_EXISTING_HEAD); cl_assert_equal_i(GIT_EORPHANEDHEAD, git_repository_head(&head, repo)); } |