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
8d7717c4
Commit
8d7717c4
authored
Dec 20, 2016
by
Edward Thomson
Committed by
GitHub
Dec 20, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4034 from libgit2/cmn/sysdir-no-reguess
sysdir: don't re-guess when using variable substitution
parents
f91f170f
9f09f290
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
1 deletions
+22
-1
src/sysdir.c
+1
-1
tests/core/env.c
+21
-0
No files found.
src/sysdir.c
View file @
8d7717c4
...
...
@@ -171,7 +171,7 @@ int git_sysdir_set(git_sysdir_t which, const char *search_path)
expand_path
=
strstr
(
search_path
,
PATH_MAGIC
);
/* reset the default if this path has been cleared */
if
(
!
search_path
||
expand_path
)
if
(
!
search_path
)
git_sysdir__dirs
[
which
].
guess
(
&
git_sysdir__dirs
[
which
].
buf
);
/* if $PATH is not referenced, then just set the path */
...
...
tests/core/env.c
View file @
8d7717c4
...
...
@@ -298,3 +298,24 @@ void test_core_env__2(void)
git_buf_free
(
&
path
);
git_buf_free
(
&
found
);
}
void
test_core_env__substitution
(
void
)
{
git_buf
buf
=
GIT_BUF_INIT
,
expected
=
GIT_BUF_INIT
;
/* Set it to something non-default so we have controllable values */
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
"/tmp/a"
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_GET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
&
buf
));
cl_assert_equal_s
(
"/tmp/a"
,
buf
.
ptr
);
git_buf_clear
(
&
buf
);
cl_git_pass
(
git_buf_join
(
&
buf
,
GIT_PATH_LIST_SEPARATOR
,
"$PATH"
,
"/tmp/b"
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_SET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
buf
.
ptr
));
cl_git_pass
(
git_libgit2_opts
(
GIT_OPT_GET_SEARCH_PATH
,
GIT_CONFIG_LEVEL_GLOBAL
,
&
buf
));
cl_git_pass
(
git_buf_join
(
&
expected
,
GIT_PATH_LIST_SEPARATOR
,
"/tmp/a"
,
"/tmp/b"
));
cl_assert_equal_s
(
expected
.
ptr
,
buf
.
ptr
);
git_buf_free
(
&
expected
);
git_buf_free
(
&
buf
);
}
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