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
7018e3b7
Commit
7018e3b7
authored
9 years ago
by
Edward Thomson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3723 from libgit2/cmn/ignore-symlink
ignore: don't use realpath to canonicalize path
parents
36fc2557
d364dc8b
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
3 deletions
+24
-3
src/ignore.c
+11
-3
tests/attr/ignore.c
+13
-0
No files found.
src/ignore.c
View file @
7018e3b7
...
...
@@ -263,10 +263,18 @@ int git_ignore__for_path(
goto
cleanup
;
/* given a unrooted path in a non-bare repo, resolve it */
if
(
workdir
&&
git_path_root
(
path
)
<
0
)
error
=
git_path_find_dir
(
&
ignores
->
dir
,
path
,
workdir
);
else
if
(
workdir
&&
git_path_root
(
path
)
<
0
)
{
git_buf
local
=
GIT_BUF_INIT
;
if
((
error
=
git_path_dirname_r
(
&
local
,
path
))
<
0
||
(
error
=
git_path_resolve_relative
(
&
local
,
0
))
<
0
||
(
error
=
git_path_to_dir
(
&
local
))
<
0
||
(
error
=
git_buf_joinpath
(
&
ignores
->
dir
,
workdir
,
local
.
ptr
))
<
0
)
{;}
/* Nothing, we just want to stop on the first error */
git_buf_free
(
&
local
);
}
else
{
error
=
git_buf_joinpath
(
&
ignores
->
dir
,
path
,
""
);
}
if
(
error
<
0
)
goto
cleanup
;
...
...
This diff is collapsed.
Click to expand it.
tests/attr/ignore.c
View file @
7018e3b7
...
...
@@ -252,3 +252,16 @@ void test_attr_ignore__dont_ignore_files_for_folder(void)
if
(
cl_repo_get_bool
(
g_repo
,
"core.ignorecase"
))
assert_is_ignored
(
false
,
"dir/TeSt"
);
}
void
test_attr_ignore__symlink_to_outside
(
void
)
{
#ifdef GIT_WIN32
cl_skip
();
#endif
cl_git_rewritefile
(
"attr/.gitignore"
,
"symlink
\n
"
);
cl_git_mkfile
(
"target"
,
"target"
);
cl_git_pass
(
p_symlink
(
"../target"
,
"attr/symlink"
));
assert_is_ignored
(
true
,
"symlink"
);
assert_is_ignored
(
true
,
"lala/../symlink"
);
}
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