diff options
author | Christian Halstrick <christian.halstrick@sap.com> | 2017-08-16 06:24:33 -0400 |
---|---|---|
committer | Gerrit Code Review @ Eclipse.org <gerrit@eclipse.org> | 2017-08-16 06:24:33 -0400 |
commit | c71af0c73a06f298a983a7ff0c3e0f3bfed5181a (patch) | |
tree | dd4aea2d19deacfd460e162bafd6a79135b347bb /org.eclipse.jgit.test | |
parent | b13a285098305149b34924bce2679a0cd98d9b2c (diff) | |
parent | 4bc539a8141e8099587536620bdc555c2c4cb01e (diff) | |
download | jgit-c71af0c73a06f298a983a7ff0c3e0f3bfed5181a.tar.gz jgit-c71af0c73a06f298a983a7ff0c3e0f3bfed5181a.zip |
Merge "Use relative paths for attribute rule matching"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java index ca456b3c8a..50d020c57c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/attributes/AttributesHandlerTest.java @@ -254,6 +254,33 @@ public class AttributesHandlerTest extends RepositoryTestCase { endWalk(); } + @Test + public void testRelativePaths() throws Exception { + setupRepo("sub/ global", "sub/** init", + "sub/** top_sub\n*.txt top", + "sub/** subsub\nsub/ subsub2\n*.txt foo"); + // The last two sub/** and sub/ rules are in sub/.gitattributes. They + // must not apply to any of the files here. They would match for a + // further subdirectory sub/sub. + walk = beginWalk(); + assertIteration(F, ".gitattributes"); + assertIteration(D, "sub", attrs("global")); + assertIteration(F, "sub/.gitattributes", attrs("init top_sub global")); + assertIteration(F, "sub/a.txt", attrs("init foo top top_sub global")); + endWalk(); + // All right, let's see that they *do* apply in sub/sub: + writeTrashFile("sub/sub/b.txt", "b"); + walk = beginWalk(); + assertIteration(F, ".gitattributes"); + assertIteration(D, "sub", attrs("global")); + assertIteration(F, "sub/.gitattributes", attrs("init top_sub global")); + assertIteration(F, "sub/a.txt", attrs("init foo top top_sub global")); + assertIteration(D, "sub/sub", attrs("init subsub2 top_sub global")); + assertIteration(F, "sub/sub/b.txt", + attrs("init foo subsub2 subsub top top_sub global")); + endWalk(); + } + private static Collection<Attribute> attrs(String s) { return new AttributesRule("*", s).getAttributes(); } |