]>
Commit | Line | Data |
---|---|---|
40e48ea4 | 1 | #include "clar_libgit2.h" |
2 | #include "config/config_helpers.h" | |
3 | ||
4 | #include "repository.h" | |
5 | ||
40e48ea4 | 6 | static git_repository *_repo; |
7 | ||
8 | void test_network_remote_delete__initialize(void) | |
9 | { | |
10 | _repo = cl_git_sandbox_init("testrepo.git"); | |
40e48ea4 | 11 | } |
12 | ||
13 | void test_network_remote_delete__cleanup(void) | |
14 | { | |
15 | cl_git_sandbox_cleanup(); | |
16 | } | |
17 | ||
ec8a949a | 18 | void test_network_remote_delete__remove_remote_tracking_branches(void) |
40e48ea4 | 19 | { |
ec8a949a CMN |
20 | git_reference *ref; |
21 | ||
262eec23 | 22 | cl_git_pass(git_remote_delete(_repo, "test")); |
ec8a949a | 23 | cl_git_fail_with(GIT_ENOTFOUND, git_reference_lookup(&ref, _repo, "refs/remotes/test/master")); |
40e48ea4 | 24 | } |
25 | ||
ec8a949a | 26 | void test_network_remote_delete__remove_remote_configuration_settings(void) |
40e48ea4 | 27 | { |
28 | cl_assert(count_config_entries_match(_repo, "remote\\.test\\.+") > 0); | |
29 | ||
262eec23 | 30 | cl_git_pass(git_remote_delete(_repo, "test")); |
40e48ea4 | 31 | |
32 | cl_assert_equal_i(0, count_config_entries_match(_repo, "remote\\.test\\.+")); | |
33 | } | |
34 | ||
ec8a949a | 35 | void test_network_remote_delete__remove_branch_upstream_configuration_settings(void) |
40e48ea4 | 36 | { |
37 | assert_config_entry_existence(_repo, "branch.mergeless.remote", true); | |
38 | assert_config_entry_existence(_repo, "branch.master.remote", true); | |
39 | ||
262eec23 | 40 | cl_git_pass(git_remote_delete(_repo, "test")); |
40e48ea4 | 41 | |
42 | assert_config_entry_existence(_repo, "branch.mergeless.remote", false); | |
43 | assert_config_entry_existence(_repo, "branch.mergeless.merge", false); | |
44 | assert_config_entry_existence(_repo, "branch.master.remote", false); | |
45 | assert_config_entry_existence(_repo, "branch.master.merge", false); | |
46 | } |