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
31059923
Commit
31059923
authored
7 years ago
by
Patrick Steinhardt
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4169 from csware/absolute-symlink
parents
e30a6ee3
c10ce7c2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
1 deletions
+30
-1
src/filebuf.c
+1
-1
tests/core/filebuf.c
+29
-0
No files found.
src/filebuf.c
View file @
31059923
...
...
@@ -246,7 +246,7 @@ static int resolve_symlink(git_buf *out, const char *path)
root
=
git_path_root
(
target
.
ptr
);
if
(
root
>=
0
)
{
if
((
error
=
git_buf_
pu
ts
(
&
curpath
,
target
.
ptr
))
<
0
)
if
((
error
=
git_buf_
se
ts
(
&
curpath
,
target
.
ptr
))
<
0
)
goto
cleanup
;
}
else
{
git_buf
dir
=
GIT_BUF_INIT
;
...
...
This diff is collapsed.
Click to expand it.
tests/core/filebuf.c
View file @
31059923
...
...
@@ -187,6 +187,35 @@ void test_core_filebuf__symlink_follow(void)
cl_git_pass
(
git_futils_rmdir_r
(
dir
,
NULL
,
GIT_RMDIR_REMOVE_FILES
));
}
void
test_core_filebuf__symlink_follow_absolute_paths
(
void
)
{
git_filebuf
file
=
GIT_FILEBUF_INIT
;
git_buf
source
=
GIT_BUF_INIT
,
target
=
GIT_BUF_INIT
;
#ifdef GIT_WIN32
cl_skip
();
#endif
cl_git_pass
(
git_buf_joinpath
(
&
source
,
clar_sandbox_path
(),
"linkdir/link"
));
cl_git_pass
(
git_buf_joinpath
(
&
target
,
clar_sandbox_path
(),
"linkdir/target"
));
cl_git_pass
(
p_mkdir
(
"linkdir"
,
0777
));
cl_git_pass
(
p_symlink
(
target
.
ptr
,
source
.
ptr
));
cl_git_pass
(
git_filebuf_open
(
&
file
,
source
.
ptr
,
0
,
0666
));
cl_git_pass
(
git_filebuf_printf
(
&
file
,
"%s
\n
"
,
"libgit2 rocks"
));
cl_assert_equal_i
(
true
,
git_path_exists
(
"linkdir/target.lock"
));
cl_git_pass
(
git_filebuf_commit
(
&
file
));
cl_assert_equal_i
(
true
,
git_path_exists
(
"linkdir/target"
));
git_filebuf_cleanup
(
&
file
);
git_buf_free
(
&
source
);
git_buf_free
(
&
target
);
cl_git_pass
(
git_futils_rmdir_r
(
"linkdir"
,
NULL
,
GIT_RMDIR_REMOVE_FILES
));
}
void
test_core_filebuf__symlink_depth
(
void
)
{
git_filebuf
file
=
GIT_FILEBUF_INIT
;
...
...
This diff is collapsed.
Click to expand it.
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