diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2010-01-28 23:49:38 -0500 |
---|---|---|
committer | Code Review <codereview-daemon@eclipse.org> | 2010-01-28 23:49:38 -0500 |
commit | baaa78f1f05d197ba2efefb713f194cd3f09725d (patch) | |
tree | d51fa47a7b9c66cb9839ee5108d82b4c4aa124f9 /org.eclipse.jgit.test | |
parent | 94599930e75b941869b02d0ea1147d6be0cb4ab4 (diff) | |
parent | 48e9a010ae9cfee5cc2daae2bf20d510ab9c108f (diff) | |
download | jgit-baaa78f1f05d197ba2efefb713f194cd3f09725d.tar.gz jgit-baaa78f1f05d197ba2efefb713f194cd3f09725d.zip |
Merge "Add unsetSection to Config to remove an entire block"
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java index 203b7c8251..41c4971a04 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/lib/RepositoryConfigTest.java @@ -271,6 +271,47 @@ public class RepositoryConfigTest extends TestCase { assertEquals("[my]\n\tempty =\n", c.toText()); } + public void testUnsetBranchSection() throws ConfigInvalidException { + Config c = parse("" // + + "[branch \"keep\"]\n" + + " merge = master.branch.to.keep.in.the.file\n" + + "\n" + + "[branch \"remove\"]\n" + + " merge = this.will.get.deleted\n" + + " remote = origin-for-some-long-gone-place\n" + + "\n" + + "[core-section-not-to-remove-in-test]\n" + + " packedGitLimit = 14\n"); + c.unsetSection("branch", "does.not.exist"); + c.unsetSection("branch", "remove"); + assertEquals("" // + + "[branch \"keep\"]\n" + + " merge = master.branch.to.keep.in.the.file\n" + + "\n" + + "[core-section-not-to-remove-in-test]\n" + + " packedGitLimit = 14\n", c.toText()); + } + + public void testUnsetSingleSection() throws ConfigInvalidException { + Config c = parse("" // + + "[branch \"keep\"]\n" + + " merge = master.branch.to.keep.in.the.file\n" + + "\n" + + "[single]\n" + + " merge = this.will.get.deleted\n" + + " remote = origin-for-some-long-gone-place\n" + + "\n" + + "[core-section-not-to-remove-in-test]\n" + + " packedGitLimit = 14\n"); + c.unsetSection("single", null); + assertEquals("" // + + "[branch \"keep\"]\n" + + " merge = master.branch.to.keep.in.the.file\n" + + "\n" + + "[core-section-not-to-remove-in-test]\n" + + " packedGitLimit = 14\n", c.toText()); + } + private void assertReadLong(long exp) throws ConfigInvalidException { assertReadLong(exp, String.valueOf(exp)); } |