summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 13d1cc3)
raw | patch | inline | side by side (parent: 13d1cc3)
author | Alex Riesen <raa.lkml@gmail.com> | |
Wed, 2 Nov 2005 13:05:45 +0000 (14:05 +0100) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Thu, 3 Nov 2005 00:50:58 +0000 (16:50 -0800) |
For everyone cursed by dos/windows line endings (aka CRLF):
The code reading the .gitignore files (excludes and excludes per
directory) leaves \r in the patterns, which causes fnmatch to fail for
no obvious reason. Just remove a "\r" preceding a "\n"
unconditionally.
Signed-off-by: Junio C Hamano <junkio@cox.net>
The code reading the .gitignore files (excludes and excludes per
directory) leaves \r in the patterns, which causes fnmatch to fail for
no obvious reason. Just remove a "\r" preceding a "\n"
unconditionally.
Signed-off-by: Junio C Hamano <junkio@cox.net>
ls-files.c | patch | blob | history | |
t/t3001-ls-files-others-exclude.sh | patch | blob | history |
diff --git a/ls-files.c b/ls-files.c
index 3085b2fc8c7e8920ecca8e9c0657d6124b0fbfda..d9c8b215f1dcc48ebd7de9f92713f43a09a80e66 100644 (file)
--- a/ls-files.c
+++ b/ls-files.c
for (i = 0; i < size; i++) {
if (buf[i] == '\n') {
if (entry != buf + i && entry[0] != '#') {
- buf[i] = 0;
+ buf[i - (i && buf[i-1] == '\r')] = 0;
add_exclude(entry, base, baselen, which);
}
entry = buf + i + 1;
index 5beaaa33752daceb216ec7dec50727b9bd03682c..fde2bb25fa0fb41c09b4e4c87de8b9d1c0f9c237 100755 (executable)
>output &&
diff -u expect output'
+# Test \r\n (MSDOS-like systems)
+echo -ne '*.1\r\n/*.3\r\n!*.6\r\n' >.gitignore
+
+test_expect_success \
+ 'git-ls-files --others with \r\n line endings.' \
+ 'git-ls-files --others \
+ --exclude=\*.6 \
+ --exclude-per-directory=.gitignore \
+ --exclude-from=.git/ignore \
+ >output &&
+ diff -u expect output'
+
test_done