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
527508b0
Commit
527508b0
authored
Oct 08, 2012
by
Russell Belfer
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #966 from pwkelley/icasefix
Fix a bug where ignorecase wasn't applied to ignores
parents
acd17006
edb456c3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
4 deletions
+26
-4
src/ignore.c
+5
-4
tests-clar/status/ignore.c
+21
-0
No files found.
src/ignore.c
View file @
527508b0
...
...
@@ -48,13 +48,14 @@ static int parse_ignore_file(
match
->
flags
=
GIT_ATTR_FNMATCH_ALLOWSPACE
;
if
(
ignore_case
)
match
->
flags
|=
GIT_ATTR_FNMATCH_ICASE
;
if
(
!
(
error
=
git_attr_fnmatch__parse
(
match
,
ignores
->
pool
,
context
,
&
scan
)))
{
match
->
flags
=
match
->
flags
|
GIT_ATTR_FNMATCH_IGNORE
;
match
->
flags
|=
GIT_ATTR_FNMATCH_IGNORE
;
if
(
ignore_case
)
match
->
flags
|=
GIT_ATTR_FNMATCH_ICASE
;
scan
=
git__next_line
(
scan
);
error
=
git_vector_insert
(
&
ignores
->
rules
,
match
);
}
...
...
tests-clar/status/ignore.c
View file @
527508b0
#include "clar_libgit2.h"
#include "fileops.h"
#include "git2/attr.h"
#include "ignore.h"
#include "attr.h"
#include "status_helpers.h"
...
...
@@ -152,6 +153,26 @@ void test_status_ignore__ignore_pattern_contains_space(void)
cl_assert
(
flags
==
GIT_STATUS_WT_NEW
);
}
void
test_status_ignore__ignore_pattern_ignorecase
(
void
)
{
unsigned
int
flags
;
const
mode_t
mode
=
0777
;
bool
ignore_case
;
git_index
*
index
;
g_repo
=
cl_git_sandbox_init
(
"empty_standard_repo"
);
cl_git_rewritefile
(
"empty_standard_repo/.gitignore"
,
"a.txt
\n
"
);
cl_git_mkfile
(
"empty_standard_repo/A.txt"
,
"Differs in case"
);
cl_git_pass
(
git_repository_index
(
&
index
,
g_repo
));
ignore_case
=
index
->
ignore_case
;
git_index_free
(
index
);
cl_git_pass
(
git_status_file
(
&
flags
,
g_repo
,
"A.txt"
));
cl_assert
(
flags
==
ignore_case
?
GIT_STATUS_IGNORED
:
GIT_STATUS_WT_NEW
);
}
void
test_status_ignore__adding_internal_ignores
(
void
)
{
int
ignored
;
...
...
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