diff options
| author | Vicent Marti <tanoku@gmail.com> | 2013-06-25 00:25:35 +0200 |
|---|---|---|
| committer | Vicent Marti <tanoku@gmail.com> | 2013-06-25 00:25:35 +0200 |
| commit | 29d7242b1dcd1f09a63417abd648a6217b85d301 (patch) | |
| tree | dedc3bc07a500770382ca4c517e4bb015e506c4b /tests-clar/repo/open.c | |
| parent | a50086d174658914d4d6462afbc83b02825b1f5b (diff) | |
| parent | eddc1f1ed78898a4ca41480045b1d0d5b075e773 (diff) | |
| download | libgit2-29d7242b1dcd1f09a63417abd648a6217b85d301.tar.gz | |
Merge branch 'development'
Diffstat (limited to 'tests-clar/repo/open.c')
| -rw-r--r-- | tests-clar/repo/open.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/tests-clar/repo/open.c b/tests-clar/repo/open.c index 7f93ae91a..840858586 100644 --- a/tests-clar/repo/open.c +++ b/tests-clar/repo/open.c @@ -280,3 +280,38 @@ void test_repo_open__opening_a_non_existing_repository_returns_ENOTFOUND(void) git_repository *repo; cl_assert_equal_i(GIT_ENOTFOUND, git_repository_open(&repo, "i-do-not/exist")); } + +void test_repo_open__no_config(void) +{ + git_buf path = GIT_BUF_INIT; + git_repository *repo; + git_config *config; + + cl_fixture_sandbox("empty_standard_repo"); + cl_git_pass(cl_rename("empty_standard_repo/.gitted", "empty_standard_repo/.git")); + + /* remove local config */ + cl_git_pass(git_futils_rmdir_r( + "empty_standard_repo/.git/config", NULL, GIT_RMDIR_REMOVE_FILES)); + + /* isolate from system level configs */ + cl_must_pass(p_mkdir("alternate", 0777)); + cl_git_pass(git_path_prettify(&path, "alternate", NULL)); + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_GLOBAL, path.ptr)); + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_SYSTEM, path.ptr)); + cl_git_pass(git_libgit2_opts( + GIT_OPT_SET_SEARCH_PATH, GIT_CONFIG_LEVEL_XDG, path.ptr)); + + git_buf_free(&path); + + cl_git_pass(git_repository_open(&repo, "empty_standard_repo")); + cl_git_pass(git_repository_config(&config, repo)); + + cl_git_pass(git_config_set_string(config, "test.set", "42")); + + git_config_free(config); + git_repository_free(repo); + cl_fixture_cleanup("empty_standard_repo"); +} |
