forked from eclipse-jgit/jgit
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jente Sondervorst
committed
Oct 25, 2024
1 parent
8188c4a
commit 2e4b5b5
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
/.idea | ||
/.project | ||
/org.eclipse.jgit.benchmarks/dependency-reduced-pom.xml | ||
target/ | ||
|
43 changes: 43 additions & 0 deletions
43
org.eclipse.jgit.test/tst/org/eclipse/jgit/ignore/ShowcaseBehaviour1Test.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
package org.eclipse.jgit.ignore; | ||
|
||
import org.junit.Test; | ||
|
||
import java.io.ByteArrayInputStream; | ||
import java.io.IOException; | ||
|
||
import static org.junit.Assert.assertEquals; | ||
import static org.junit.Assert.assertTrue; | ||
|
||
public class ShowcaseBehaviour1Test { | ||
|
||
//Let's load a "file" containing a single rule for /directory/nested/. | ||
//This should exclude the directory /directory/nested/again | ||
@Test | ||
public void IgnoreNodeUsesPathMatchTrue() throws IOException { | ||
IgnoreNode ignoreNode = new IgnoreNode(); | ||
ignoreNode.parse(new ByteArrayInputStream("/directory/nested/".getBytes())); | ||
|
||
IgnoreNode.MatchResult isIgnored = ignoreNode.isIgnored("/directory/nested/again", true); | ||
|
||
assertEquals(IgnoreNode.MatchResult.IGNORED, isIgnored); | ||
// The result should not be CHECK_PARENT? | ||
} | ||
|
||
//IgnoreNode.MatchResult isIgnored = ignoreNode.isIgnored("/directory/nested/again", true); | ||
// ^^^^^^^^^ | ||
// Path match is always sent as true (see difference in next test) | ||
// The result is NOT correct | ||
|
||
@Test | ||
public void fastIgnoreRuleForNestedDirectory() { | ||
//This PASSES as isMatch returns true | ||
FastIgnoreRule ignoreRule1 = new FastIgnoreRule("/directory/nested/"); | ||
assertTrue(ignoreRule1.isMatch("/directory/nested/again", true, false)); // It matches the directory | ||
// ^^^^^ | ||
|
||
//This FAILS as isMatch returns false | ||
FastIgnoreRule ignoreRule2 = new FastIgnoreRule("/directory/nested/"); | ||
assertTrue(ignoreRule2.isMatch("/directory/nested/again", true, true)); // It matches the directory | ||
// ^^^^^ | ||
} | ||
} |