@@ -27,22 +27,54 @@ void test_config_global__initialize(void)
2727void test_config_global__cleanup (void )
2828{
2929 cl_sandbox_set_search_path_defaults ();
30+ cl_git_pass (git_futils_rmdir_r ("home" , NULL , GIT_RMDIR_REMOVE_FILES ));
31+ cl_git_pass (git_futils_rmdir_r ("xdg" , NULL , GIT_RMDIR_REMOVE_FILES ));
32+ cl_git_pass (git_futils_rmdir_r ("etc" , NULL , GIT_RMDIR_REMOVE_FILES ));
3033}
3134
3235void test_config_global__open_global (void )
3336{
3437 git_config * cfg , * global , * selected , * dummy ;
38+ int32_t value ;
39+
40+ cl_git_mkfile ("home/.gitconfig" , "[global]\n test = 4567\n" );
3541
3642 cl_git_pass (git_config_open_default (& cfg ));
43+ cl_git_pass (git_config_get_int32 (& value , cfg , "global.test" ));
44+ cl_assert_equal_i (4567 , value );
45+
3746 cl_git_pass (git_config_open_level (& global , cfg , GIT_CONFIG_LEVEL_GLOBAL ));
47+ cl_git_pass (git_config_get_int32 (& value , global , "global.test" ));
48+ cl_assert_equal_i (4567 , value );
49+
3850 cl_git_fail (git_config_open_level (& dummy , cfg , GIT_CONFIG_LEVEL_XDG ));
51+
3952 cl_git_pass (git_config_open_global (& selected , cfg ));
53+ cl_git_pass (git_config_get_int32 (& value , selected , "global.test" ));
54+ cl_assert_equal_i (4567 , value );
4055
4156 git_config_free (selected );
4257 git_config_free (global );
4358 git_config_free (cfg );
4459}
4560
61+ void test_config_global__open_symlinked_global (void )
62+ {
63+ #ifndef GIT_WIN32
64+ git_config * cfg ;
65+ int32_t value ;
66+
67+ cl_git_mkfile ("home/.gitconfig.linked" , "[global]\n test = 4567\n" );
68+ cl_must_pass (symlink (".gitconfig.linked" , "home/.gitconfig" ));
69+
70+ cl_git_pass (git_config_open_default (& cfg ));
71+ cl_git_pass (git_config_get_int32 (& value , cfg , "global.test" ));
72+ cl_assert_equal_i (4567 , value );
73+
74+ git_config_free (cfg );
75+ #endif
76+ }
77+
4678void test_config_global__open_xdg (void )
4779{
4880 git_config * cfg , * xdg , * selected ;
0 commit comments