Support "\" in non-wildcard exclusion entries

"\" was treated differently in exclude rules depending on whether a
wildcard match was done. For wildcard rules, "\" was de-escaped in
fnmatch, but this was not done for other rules since they used strcmp
instead.  A file named "#foo" would not be excluded by "\#foo", but would
be excluded by "\#foo*".

We now treat all rules with "\" as wildcard rules.

Another solution could be to de-escape all non-wildcard rules as we
read them, but we would have to do the de-escaping exactly as fnmatch
does it to avoid inconsistencies.

Signed-off-by: Finn Arne Gangstad <finnag@pvv.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
Finn Arne Gangstad
2009-02-10 15:20:17 +01:00
committed by Junio C Hamano
parent ab2fdb3b62
commit dd482eeac2
2 changed files with 9 additions and 2 deletions

View File

@ -19,6 +19,9 @@ do
>$dir/a.$i
done
done
>"#ignore1"
>"#ignore2"
>"#hidden"
cat >expect <<EOF
a.2
@ -42,6 +45,9 @@ three/a.8
EOF
echo '.gitignore
\#ignore1
\#ignore2*
\#hid*n
output
expect
.gitignore
@ -79,9 +85,10 @@ test_expect_success \
>output &&
test_cmp expect output'
cat > excludes-file << EOF
cat > excludes-file <<\EOF
*.[1-8]
e*
\#*
EOF
git config core.excludesFile excludes-file