Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
git2
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
git2
Commits
1c8de380
Commit
1c8de380
authored
Sep 20, 2013
by
Russell Belfer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make tests pass if XDG config exists
parent
4dbdbf64
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
9 deletions
+14
-9
tests-clar/config/global.c
+14
-9
No files found.
tests-clar/config/global.c
View file @
1c8de380
...
...
@@ -6,18 +6,21 @@ void test_config_global__initialize(void)
{
git_buf
path
=
GIT_BUF_INIT
;
cl_
must_pass
(
p_mkdir
(
"home"
,
0777
));
cl_
assert_equal_i
(
0
,
p_mkdir
(
"home"
,
0777
));
cl_git_pass
(
git_path_prettify
(
&
path
,
"home"
,
NULL
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
path
.
ptr
));
cl_must_pass
(
p_mkdir
(
"xdg"
,
0777
));
cl_git_pass
(
git_path_prettify
(
&
path
,
"xdg"
,
NULL
));
cl_assert_equal_i
(
0
,
p_mkdir
(
"xdg"
,
0777
));
cl_assert_equal_i
(
0
,
p_mkdir
(
"xdg/git"
,
0777
));
cl_git_pass
(
git_path_prettify
(
&
path
,
"xdg/git"
,
NULL
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_
SYSTEM
,
path
.
ptr
));
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_
XDG
,
path
.
ptr
));
cl_assert_equal_i
(
0
,
p_mkdir
(
"etc"
,
0777
));
cl_git_pass
(
git_path_prettify
(
&
path
,
"etc"
,
NULL
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_
XDG
,
NULL
));
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_
SYSTEM
,
path
.
ptr
));
git_buf_free
(
&
path
);
}
...
...
@@ -26,6 +29,11 @@ void test_config_global__cleanup(void)
{
cl_git_pass
(
git_futils_rmdir_r
(
"home"
,
NULL
,
GIT_RMDIR_REMOVE_FILES
));
cl_git_pass
(
git_futils_rmdir_r
(
"xdg"
,
NULL
,
GIT_RMDIR_REMOVE_FILES
));
cl_git_pass
(
git_futils_rmdir_r
(
"etc"
,
NULL
,
GIT_RMDIR_REMOVE_FILES
));
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_SYSTEM
,
NULL
);
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_XDG
,
NULL
);
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
NULL
);
}
void
test_config_global__open_global
(
void
)
...
...
@@ -48,10 +56,7 @@ void test_config_global__open_xdg(void)
const
char
*
val
,
*
str
=
"teststring"
;
const
char
*
key
=
"this.variable"
;
p_setenv
(
"XDG_CONFIG_HOME"
,
"xdg"
,
1
);
cl_must_pass
(
p_mkdir
(
"xdg/git/"
,
0777
));
cl_git_mkfile
(
"xdg/git/config"
,
""
);
cl_git_mkfile
(
"xdg/git/config"
,
"# XDG config
\n
[core]
\n
test = 1
\n
"
);
cl_git_pass
(
git_config_open_default
(
&
cfg
));
cl_git_pass
(
git_config_open_level
(
&
xdg
,
cfg
,
GIT_CONFIG_LEVEL_XDG
));
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment