|
1 | 1 | #include "clar_libgit2.h" |
2 | 2 |
|
3 | | -static git_remote *_remote; |
4 | 3 | static git_repository *_repo; |
5 | 4 | static git_config *_config; |
6 | 5 | static char url[] = "http://github.com/libgit2/libgit2.git"; |
7 | 6 |
|
8 | | -void test_network_remote_createthenload__initialize(void) |
| 7 | +void test_remote_create__initialize(void) |
9 | 8 | { |
10 | 9 | cl_fixture_sandbox("testrepo.git"); |
11 | 10 |
|
12 | 11 | cl_git_pass(git_repository_open(&_repo, "testrepo.git")); |
13 | 12 |
|
14 | 13 | cl_git_pass(git_repository_config(&_config, _repo)); |
15 | | - cl_git_pass(git_config_set_string(_config, "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*")); |
16 | | - cl_git_pass(git_config_set_string(_config, "remote.origin.url", url)); |
17 | | - git_config_free(_config); |
18 | | - |
19 | | - cl_git_pass(git_remote_lookup(&_remote, _repo, "origin")); |
20 | 14 | } |
21 | 15 |
|
22 | | -void test_network_remote_createthenload__cleanup(void) |
| 16 | +void test_remote_create__cleanup(void) |
23 | 17 | { |
24 | | - git_remote_free(_remote); |
25 | | - _remote = NULL; |
| 18 | + git_config_free(_config); |
26 | 19 |
|
27 | 20 | git_repository_free(_repo); |
28 | 21 | _repo = NULL; |
29 | 22 |
|
30 | 23 | cl_fixture_cleanup("testrepo.git"); |
31 | 24 | } |
32 | 25 |
|
33 | | -void test_network_remote_createthenload__parsing(void) |
| 26 | +void test_remote_create__manual(void) |
34 | 27 | { |
35 | | - cl_assert_equal_s(git_remote_name(_remote), "origin"); |
36 | | - cl_assert_equal_s(git_remote_url(_remote), url); |
| 28 | + git_remote *remote; |
| 29 | + cl_git_pass(git_config_set_string(_config, "remote.origin.fetch", "+refs/heads/*:refs/remotes/origin/*")); |
| 30 | + cl_git_pass(git_config_set_string(_config, "remote.origin.url", url)); |
| 31 | + |
| 32 | + cl_git_pass(git_remote_lookup(&remote, _repo, "origin")); |
| 33 | + cl_assert_equal_s(git_remote_name(remote), "origin"); |
| 34 | + cl_assert_equal_s(git_remote_url(remote), url); |
| 35 | + |
| 36 | + git_remote_free(remote); |
37 | 37 | } |
0 commit comments