summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarlos Martín Nieto <carlosmn@github.com>2017-11-04 23:34:14 +0100
committerGitHub <noreply@github.com>2017-11-04 23:34:14 +0100
commit8233f6e36d8827986e1baeff4b7b4daa2cce46f4 (patch)
tree2303c46c306970d17d927c77ce2a8515da5d225a /src
parent6f1e4f4f4888d6ba78173d5aaf0f345713a847d7 (diff)
parent5cb6a2c946a071d43be3cdabf2f6d4417a4be694 (diff)
downloadlibgit2-8233f6e36d8827986e1baeff4b7b4daa2cce46f4.tar.gz
Merge pull request #4386 from novalis/gitignore-ignore-space
ignore spaces in .gitignore files
Diffstat (limited to 'src')
-rw-r--r--src/ignore.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/ignore.c b/src/ignore.c
index f089dbeb5..615cd94bf 100644
--- a/src/ignore.c
+++ b/src/ignore.c
@@ -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);
/*