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
68842cbb
Commit
68842cbb
authored
7 years ago
by
David Turner
Committed by
Patrick Steinhardt
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ignore trailing whitespace in .gitignore files (as git itself does)
parent
e66bc08c
Hide 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 @
68842cbb
...
...
@@ -205,6 +205,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
);
/*
...
...
This diff is collapsed.
Click to expand it.
tests/attr/ignore.c
View file @
68842cbb
...
...
@@ -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"
);
...
...
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