]>
git.proxmox.com Git - libgit2.git/blob - tests-clar/refs/branches/move.c
1 #include "clar_libgit2.h"
4 static git_repository
*repo
;
6 void test_refs_branches_move__initialize(void)
8 cl_fixture_sandbox("testrepo.git");
9 cl_git_pass(git_repository_open(&repo
, "testrepo.git"));
12 void test_refs_branches_move__cleanup(void)
14 git_repository_free(repo
);
16 cl_fixture_cleanup("testrepo.git");
19 #define NEW_BRANCH_NAME "new-branch-on-the-block"
21 void test_refs_branches_move__can_move_a_local_branch(void)
23 cl_git_pass(git_branch_move(repo
, "br2", NEW_BRANCH_NAME
, 0));
26 void test_refs_branches_move__can_move_a_local_branch_to_a_different_namespace(void)
29 cl_git_pass(git_branch_move(repo
, "br2", "somewhere/" NEW_BRANCH_NAME
, 0));
32 cl_git_pass(git_branch_move(repo
, "somewhere/" NEW_BRANCH_NAME
, "br2", 0));
35 void test_refs_branches_move__can_move_a_local_branch_to_a_partially_colliding_namespace(void)
38 cl_git_pass(git_branch_move(repo
, "br2", "br2/" NEW_BRANCH_NAME
, 0));
41 cl_git_pass(git_branch_move(repo
, "br2/" NEW_BRANCH_NAME
, "br2", 0));
44 void test_refs_branches_move__can_not_move_a_branch_if_its_destination_name_collide_with_an_existing_one(void)
46 cl_git_fail(git_branch_move(repo
, "br2", "master", 0));
49 void test_refs_branches_move__can_not_move_a_non_existing_branch(void)
51 cl_git_fail(git_branch_move(repo
, "i-am-no-branch", NEW_BRANCH_NAME
, 0));
54 void test_refs_branches_move__can_force_move_over_an_existing_branch(void)
56 cl_git_pass(git_branch_move(repo
, "br2", "master", 1));
59 void test_refs_branches_move__can_not_move_a_branch_through_its_canonical_name(void)
61 cl_git_fail(git_branch_move(repo
, "refs/heads/br2", NEW_BRANCH_NAME
, 1));