diff options
| author | Steve King Jr <stevek@axosoft.com> | 2019-03-14 15:51:15 -0700 |
|---|---|---|
| committer | Steven King Jr <stevek@axosoft.com> | 2019-03-14 16:00:13 -0700 |
| commit | e3d7bccbec2a19f9bcda15679f28a33ad98ded93 (patch) | |
| tree | 80512daa94dba905625cb2e8cf5c53fb57bf52f4 /src | |
| parent | bc74c53a3776c69bc01208e43af1613e0401f94a (diff) | |
| download | libgit2-e3d7bccbec2a19f9bcda15679f28a33ad98ded93.tar.gz | |
ignore: Do not match on prefix of negated patterns
Matching on the prefix of a negated pattern was triggering false
negatives on siblings of that pattern. e.g.
Given the .gitignore:
dir/*
!dir/sub1/sub2/**
The path `dir/a.text` would not be ignored.
Diffstat (limited to 'src')
| -rw-r--r-- | src/attr_file.c | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index 40c72ea04..8619647a3 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -429,18 +429,6 @@ bool git_attr_fnmatch__match( return (p_fnmatch(match->pattern, relpath, flags) != FNM_NOMATCH); } - /* if path is a directory prefix of a negated pattern, then match */ - if ((match->flags & GIT_ATTR_FNMATCH_NEGATIVE) && path->is_dir) { - size_t pathlen = strlen(relpath); - bool prefixed = (pathlen <= match->length) && - ((match->flags & GIT_ATTR_FNMATCH_ICASE) ? - !strncasecmp(match->pattern, relpath, pathlen) : - !strncmp(match->pattern, relpath, pathlen)); - - if (prefixed && git_path_at_end_of_segment(&match->pattern[pathlen])) - return true; - } - return (p_fnmatch(match->pattern, filename, flags) != FNM_NOMATCH); } |
