Merge branch 'jk/doc-backslash-in-exclude'

The patterns used in the .gitignore files use backslash in the way
documented for fnmatch(3); document as such to reduce confusion.

* jk/doc-backslash-in-exclude:
  doc: document backslash in gitignore patterns
main
Junio C Hamano 2025-11-04 07:48:10 -08:00
commit 5931b6b2fb
2 changed files with 7 additions and 0 deletions

View File

@ -111,6 +111,11 @@ PATTERN FORMAT
one of the characters in a range. See fnmatch(3) and the
FNM_PATHNAME flag for a more detailed description.

- A backslash ("`\`") can be used to escape any character. E.g., "`\*`"
matches a literal asterisk (and "`\a`" matches "`a`", even though
there is no need for escaping there). As with fnmatch(3), a backslash
at the end of a pattern is an invalid pattern that never matches.

Two consecutive asterisks ("`**`") in patterns matched against
full pathname may have special meaning:


View File

@ -235,6 +235,8 @@ match 1 1 1 1 aaaaaaabababab '*ab'
match 1 1 1 1 'foo*' 'foo\*'
match 0 0 0 0 foobar 'foo\*bar'
match 1 1 1 1 'f\oo' 'f\\oo'
match 0 0 0 0 \
1 1 1 1 'foo\' 'foo\'
match 1 1 1 1 ball '*[al]?'
match 0 0 0 0 ten '[ten]'
match 1 1 1 1 ten '**[!te]'