aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit.test
diff options
context:
space:
mode:
authorAndrey Loskutov <loskutov@gmx.de>2015-07-14 00:05:49 +0200
committerMatthias Sohn <matthias.sohn@sap.com>2015-07-21 00:47:28 +0200
commit08641ea413d64baed4ae8d017988fa15e52179ad (patch)
tree8dc6811638ea06135c56157f6ce445010c850d1c /org.eclipse.jgit.test
parent1d295cb7fbd48b659b9a1a37e51dfbb8c3f97675 (diff)
downloadjgit-08641ea413d64baed4ae8d017988fa15e52179ad.tar.gz
jgit-08641ea413d64baed4ae8d017988fa15e52179ad.zip
Allow leading literal '#' and '!' in ignore rules if they are escaped
According to [1] backslash can escape leading special characters '#' and '!' in ignore rules, so that they are treated literally. [1] https://www.kernel.org/pub/software/scm/git/docs/gitignore.html Bug: 463581 Change-Id: I4c02927413a9c63ea5dbf2954877080d902ec1b2 Signed-off-by: Andrey Loskutov <loskutov@gmx.de>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreRuleSpecialCasesTest.java12
1 files changed, 12 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreRuleSpecialCasesTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreRuleSpecialCasesTest.java
index 4916d40545..05443d60c0 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreRuleSpecialCasesTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/IgnoreRuleSpecialCasesTest.java
@@ -836,6 +836,18 @@ public class IgnoreRuleSpecialCasesTest {
}
@Test
+ public void testEscapedExclamationMark() throws Exception {
+ assertMatch("\\!b!.txt", "!b!.txt", true);
+ assertMatch("a\\!b!.txt", "a\\!b!.txt", true);
+ }
+
+ @Test
+ public void testEscapedHash() throws Exception {
+ assertMatch("\\#b", "#b", true);
+ assertMatch("a\\#", "a\\#", true);
+ }
+
+ @Test
public void testEscapedTrailingSpaces() throws Exception {
assertMatch("\\ ", " ", true);
assertMatch("a\\ ", "a ", true);