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
8233f6e3
Unverified
Commit
8233f6e3
authored
Nov 04, 2017
by
Carlos Martín Nieto
Committed by
GitHub
Nov 04, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4386 from novalis/gitignore-ignore-space
ignore spaces in .gitignore files
parents
6f1e4f4f
5cb6a2c9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
0 deletions
+20
-0
src/ignore.c
+10
-0
tests/attr/ignore.c
+10
-0
No files found.
src/ignore.c
View file @
8233f6e3
...
...
@@ -213,6 +213,16 @@ static int parse_ignore_file(
if
(
ignore_case
)
match
->
flags
|=
GIT_ATTR_FNMATCH_ICASE
;
while
(
match
->
length
>
0
)
{
if
(
match
->
pattern
[
match
->
length
-
1
]
==
' '
||
match
->
pattern
[
match
->
length
-
1
]
==
'\t'
)
{
match
->
pattern
[
match
->
length
-
1
]
=
0
;
match
->
length
--
;
}
else
{
break
;
}
}
scan
=
git__next_line
(
scan
);
/*
...
...
tests/attr/ignore.c
View file @
8233f6e3
...
...
@@ -51,6 +51,16 @@ void test_attr_ignore__allow_root(void)
assert_is_ignored
(
false
,
"NewFolder/NewFolder/File.txt"
);
}
void
test_attr_ignore__ignore_space
(
void
)
{
cl_git_rewritefile
(
"attr/.gitignore"
,
"/
\n\n
/NewFolder
\n
/NewFolder/NewFolder"
);
assert_is_ignored
(
false
,
"File.txt"
);
assert_is_ignored
(
true
,
"NewFolder"
);
assert_is_ignored
(
true
,
"NewFolder/NewFolder"
);
assert_is_ignored
(
true
,
"NewFolder/NewFolder/File.txt"
);
}
void
test_attr_ignore__ignore_root
(
void
)
{
cl_git_rewritefile
(
"attr/.gitignore"
,
"/
\n\n
/NewFolder
\n
/NewFolder/NewFolder"
);
...
...
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