diff options
author | Andrey Loskutov <loskutov@gmx.de> | 2015-09-25 00:37:50 +0200 |
---|---|---|
committer | Andrey Loskutov <loskutov@gmx.de> | 2015-09-26 18:16:42 +0200 |
commit | 1abd51d95373fcf7450463478b45aa7da8012cef (patch) | |
tree | 4cd9a68fe658e9b985559443b17fb5b99856da62 /org.eclipse.jgit.junit | |
parent | 4b7daecf4a827b9cf69a76e5cbd8559e8079f4c8 (diff) | |
download | jgit-1abd51d95373fcf7450463478b45aa7da8012cef.tar.gz jgit-1abd51d95373fcf7450463478b45aa7da8012cef.zip |
[ignore rules] fix for backslash handling
An attempt to re-implement not well documented Git CLI behavior for
patterns with backslashes.
It looks like Git silently ignores all \ characters in ignore rules, if
they are NOT covered by 3 cases described in [1]:
{quote}
1) ... Put a backslash ("\") in front of the first hash for patterns
that begin with a hash.
...
2) Trailing spaces are ignored unless they are quoted with backslash
("\").
...
3) Put a backslash ("\") in front of the first "!" for patterns that
begin with a literal "!", for example, "\!important!.txt".
{quote}
Undocumented also is the fact that backslash itself can be escaped by
backslash.
So \h\e\l\l\o\.t\x\t rule matches hello.txt and a\\\\b a\b in Git CLI.
Additionally, the glob parser [2] knows special meaning of backslash:
{quote}
One can remove the special meaning of '?', '*' and '[' by preceding
them by a backslash, or, in case this is part of a shell command
line, enclosing them in quotes. Between brackets these characters
stand for themselves. Thus, "[[?*\]" matches the four characters
'[', '?', '*' and '\'.
{quote}
[1] https://www.kernel.org/pub/software/scm/git/docs/gitignore.html
[2] http://man7.org/linux/man-pages/man7/glob.7.html
Bug: 478065
Change-Id: I3dc973475d1943c5622103701fa8cb3ea0684e3e
Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.junit')
0 files changed, 0 insertions, 0 deletions