]> git.proxmox.com Git - libgit2.git/blob - tests/worktree/config.c
New upstream version 0.28.1+dfsg.1
[libgit2.git] / tests / worktree / config.c
1 #include "clar_libgit2.h"
2 #include "worktree_helpers.h"
3
4 #define COMMON_REPO "testrepo"
5 #define WORKTREE_REPO "testrepo-worktree"
6
7 static worktree_fixture fixture =
8 WORKTREE_FIXTURE_INIT(COMMON_REPO, WORKTREE_REPO);
9
10 void test_worktree_config__initialize(void)
11 {
12 setup_fixture_worktree(&fixture);
13 }
14
15 void test_worktree_config__cleanup(void)
16 {
17 cleanup_fixture_worktree(&fixture);
18 }
19
20 void test_worktree_config__open(void)
21 {
22 git_config *cfg;
23
24 cl_git_pass(git_repository_config(&cfg, fixture.worktree));
25 cl_assert(cfg != NULL);
26
27 git_config_free(cfg);
28 }
29
30 void test_worktree_config__set(void)
31 {
32 git_config *cfg;
33 int32_t val;
34
35 cl_git_pass(git_repository_config(&cfg, fixture.worktree));
36 cl_git_pass(git_config_set_int32(cfg, "core.dummy", 5));
37 git_config_free(cfg);
38
39 /*
40 * reopen to verify configuration has been set in the
41 * common dir
42 */
43 cl_git_pass(git_repository_config(&cfg, fixture.repo));
44 cl_git_pass(git_config_get_int32(&val, cfg, "core.dummy"));
45 cl_assert_equal_i(val, 5);
46 git_config_free(cfg);
47 }