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
4de6eb5b
Unverified
Commit
4de6eb5b
authored
Jun 06, 2019
by
Edward Thomson
Committed by
GitHub
Jun 06, 2019
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5074 from libgit2/ethomson/ignore_leading_slash
Ignore: only treat one leading slash as a root identifier
parents
b1795e0d
e269b343
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
1 deletions
+26
-1
src/attr_file.c
+2
-1
tests/status/ignore.c
+24
-0
No files found.
src/attr_file.c
View file @
4de6eb5b
...
...
@@ -622,7 +622,8 @@ int git_attr_fnmatch__parse(
if
(
*
scan
==
'/'
)
{
spec
->
flags
=
spec
->
flags
|
GIT_ATTR_FNMATCH_FULLPATH
;
slash_count
++
;
if
(
pattern
==
scan
)
if
(
slash_count
==
1
&&
pattern
==
scan
)
pattern
++
;
}
/* remember if we see an unescaped wildcard in pattern */
...
...
tests/status/ignore.c
View file @
4de6eb5b
...
...
@@ -413,6 +413,30 @@ void test_status_ignore__leading_slash_ignores(void)
cl_assert_equal_i
(
0
,
counts
.
wrong_sorted_path
);
}
void
test_status_ignore__multiple_leading_slash
(
void
)
{
static
const
char
*
test_files
[]
=
{
"empty_standard_repo/a.test"
,
"empty_standard_repo/b.test"
,
"empty_standard_repo/c.test"
,
"empty_standard_repo/d.test"
,
NULL
};
make_test_data
(
"empty_standard_repo"
,
test_files
);
cl_git_mkfile
(
"empty_standard_repo/.gitignore"
,
"a.test
\n
"
"/b.test
\n
"
"//c.test
\n
"
"///d.test
\n
"
);
assert_is_ignored
(
"a.test"
);
assert_is_ignored
(
"b.test"
);
refute_is_ignored
(
"c.test"
);
refute_is_ignored
(
"d.test"
);
}
void
test_status_ignore__contained_dir_with_matching_name
(
void
)
{
static
const
char
*
test_files
[]
=
{
...
...
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