Don't treat "/" as valid ignore pattern
This matches the behavior of C Git. Bug: 415767 Change-Id: Ifa6500f3f6a033da40c48287630b77c47b15f4a0 Signed-off-by: Robin Stocker <robin@nibor.org>
This commit is contained in:
parent
e10dd22749
commit
52ab578cd7
|
@ -166,6 +166,17 @@ public void testWithSlashDoesNotMatchInSubDirectory() throws IOException {
|
|||
assertEntry(F, tracked, "src/a/b");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testNoPatterns() throws IOException {
|
||||
writeIgnoreFile(".gitignore", "", " ", "# comment", "/");
|
||||
writeTrashFile("a/a", "");
|
||||
|
||||
beginWalk();
|
||||
assertEntry(F, tracked, ".gitignore");
|
||||
assertEntry(D, tracked, "a");
|
||||
assertEntry(F, tracked, "a/a");
|
||||
}
|
||||
|
||||
private void beginWalk() throws CorruptObjectException {
|
||||
walk = new TreeWalk(db);
|
||||
walk.addTree(new FileTreeIterator(db));
|
||||
|
|
|
@ -102,7 +102,7 @@ public void parse(InputStream in) throws IOException {
|
|||
String txt;
|
||||
while ((txt = br.readLine()) != null) {
|
||||
txt = txt.trim();
|
||||
if (txt.length() > 0 && !txt.startsWith("#")) //$NON-NLS-1$
|
||||
if (txt.length() > 0 && !txt.startsWith("#") && !txt.equals("/")) //$NON-NLS-1$ //$NON-NLS-2$
|
||||
rules.add(new IgnoreRule(txt));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue