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
289aaa41
Commit
289aaa41
authored
3 years ago
by
Edward Thomson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ignore: validate workdir paths for ignore files
parent
9fb755d5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
7 deletions
+10
-7
src/ignore.c
+10
-7
No files found.
src/ignore.c
View file @
289aaa41
...
@@ -309,12 +309,17 @@ int git_ignore__for_path(
...
@@ -309,12 +309,17 @@ int git_ignore__for_path(
if
((
error
=
git_path_dirname_r
(
&
local
,
path
))
<
0
||
if
((
error
=
git_path_dirname_r
(
&
local
,
path
))
<
0
||
(
error
=
git_path_resolve_relative
(
&
local
,
0
))
<
0
||
(
error
=
git_path_resolve_relative
(
&
local
,
0
))
<
0
||
(
error
=
git_path_to_dir
(
&
local
))
<
0
||
(
error
=
git_path_to_dir
(
&
local
))
<
0
||
(
error
=
git_buf_joinpath
(
&
ignores
->
dir
,
workdir
,
local
.
ptr
))
<
0
)
(
error
=
git_buf_joinpath
(
&
ignores
->
dir
,
workdir
,
local
.
ptr
))
<
0
||
{;}
/* Nothing, we just want to stop on the first error */
(
error
=
git_path_validate_workdir_buf
(
repo
,
&
ignores
->
dir
))
<
0
)
{
/* Nothing, we just want to stop on the first error */
}
git_buf_dispose
(
&
local
);
git_buf_dispose
(
&
local
);
}
else
{
}
else
{
error
=
git_buf_joinpath
(
&
ignores
->
dir
,
path
,
""
);
if
(
!
(
error
=
git_buf_joinpath
(
&
ignores
->
dir
,
path
,
""
)))
error
=
git_path_validate_filesystem
(
ignores
->
dir
.
ptr
,
ignores
->
dir
.
size
);
}
}
if
(
error
<
0
)
if
(
error
<
0
)
goto
cleanup
;
goto
cleanup
;
...
@@ -590,7 +595,7 @@ int git_ignore__check_pathspec_for_exact_ignores(
...
@@ -590,7 +595,7 @@ int git_ignore__check_pathspec_for_exact_ignores(
git_attr_fnmatch
*
match
;
git_attr_fnmatch
*
match
;
int
ignored
;
int
ignored
;
git_buf
path
=
GIT_BUF_INIT
;
git_buf
path
=
GIT_BUF_INIT
;
const
char
*
wd
,
*
filename
;
const
char
*
filename
;
git_index
*
idx
;
git_index
*
idx
;
if
((
error
=
git_repository__ensure_not_bare
(
if
((
error
=
git_repository__ensure_not_bare
(
...
@@ -598,8 +603,6 @@ int git_ignore__check_pathspec_for_exact_ignores(
...
@@ -598,8 +603,6 @@ int git_ignore__check_pathspec_for_exact_ignores(
(
error
=
git_repository_index
(
&
idx
,
repo
))
<
0
)
(
error
=
git_repository_index
(
&
idx
,
repo
))
<
0
)
return
error
;
return
error
;
wd
=
git_repository_workdir
(
repo
);
git_vector_foreach
(
vspec
,
i
,
match
)
{
git_vector_foreach
(
vspec
,
i
,
match
)
{
/* skip wildcard matches (if they are being used) */
/* skip wildcard matches (if they are being used) */
if
((
match
->
flags
&
GIT_ATTR_FNMATCH_HASWILD
)
!=
0
&&
if
((
match
->
flags
&
GIT_ATTR_FNMATCH_HASWILD
)
!=
0
&&
...
@@ -612,7 +615,7 @@ int git_ignore__check_pathspec_for_exact_ignores(
...
@@ -612,7 +615,7 @@ int git_ignore__check_pathspec_for_exact_ignores(
if
(
git_index_get_bypath
(
idx
,
filename
,
0
)
!=
NULL
)
if
(
git_index_get_bypath
(
idx
,
filename
,
0
)
!=
NULL
)
continue
;
continue
;
if
((
error
=
git_
buf_joinpath
(
&
path
,
wd
,
filename
))
<
0
)
if
((
error
=
git_
repository_workdir_path
(
&
path
,
repo
,
filename
))
<
0
)
break
;
break
;
/* is there a file on disk that matches this exactly? */
/* is there a file on disk that matches this exactly? */
...
...
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