diff options
author | Edward Thomson <ethomson@edwardthomson.com> | 2014-11-05 10:47:19 -0500 |
---|---|---|
committer | Edward Thomson <ethomson@edwardthomson.com> | 2014-11-05 10:47:19 -0500 |
commit | b4e5432ff032c7d05c82ad2871e27f990493d6b7 (patch) | |
tree | 805eb64b87fc5dd15a6a14b82851e9e6631f1fdc /src | |
parent | 3f8d005a82b39c504220d65b6a6aa696c3b1a9c4 (diff) | |
parent | 5c54e2162a21cb909e961c62f53e7d4c64f80cb0 (diff) | |
download | libgit2-b4e5432ff032c7d05c82ad2871e27f990493d6b7.tar.gz |
Merge pull request #2688 from libgit2/cmn/ignore-file-trailing-cr
ignore: consider files with a CR in their names
Diffstat (limited to 'src')
-rw-r--r-- | src/attr_file.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/attr_file.c b/src/attr_file.c index 07ffacbaf..562075291 100644 --- a/src/attr_file.c +++ b/src/attr_file.c @@ -543,7 +543,7 @@ int git_attr_fnmatch__parse( for (scan = pattern; *scan != '\0'; ++scan) { /* scan until (non-escaped) white space */ if (git__isspace(*scan) && *(scan - 1) != '\\') { - if (!allow_space || (*scan != ' ' && *scan != '\t')) + if (!allow_space || (*scan != ' ' && *scan != '\t' && *scan != '\r')) break; } @@ -564,6 +564,15 @@ int git_attr_fnmatch__parse( if ((spec->length = scan - pattern) == 0) return GIT_ENOTFOUND; + /* + * Remove one trailing \r in case this is a CRLF delimited + * file, in the case of Icon\r\r\n, we still leave the first + * \r there to match against. + */ + if (pattern[spec->length - 1] == '\r') + if (--spec->length == 0) + return GIT_ENOTFOUND; + if (pattern[spec->length - 1] == '/') { spec->length--; spec->flags = spec->flags | GIT_ATTR_FNMATCH_DIRECTORY; |