diff options
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java index 00e5f06747..145d899028 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java @@ -286,6 +286,29 @@ public class DiffFormatterTest extends RepositoryTestCase { } @Test + public void testCreateFileHeaderForRenameModeChange() + throws Exception { + DiffEntry a = DiffEntry.delete(PATH_A, ObjectId.zeroId()); + DiffEntry b = DiffEntry.add(PATH_B, ObjectId.zeroId()); + b.oldMode = FileMode.REGULAR_FILE; + b.newMode = FileMode.EXECUTABLE_FILE; + DiffEntry m = DiffEntry.pair(ChangeType.RENAME, a, b, 100); + m.oldId = null; + m.newId = null; + + FileHeader fh = df.toFileHeader(m); + //@formatter:off + String expected = DIFF + "a/src/a b/src/b\n" + + "old mode 100644\n" + + "new mode 100755\n" + + "similarity index 100%\n" + + "rename from src/a\n" + + "rename to src/b\n"; + //@formatter:on + assertEquals(expected, fh.getScriptText()); + } + + @Test public void testDiff() throws Exception { write(new File(db.getDirectory().getParent(), "test.txt"), "test"); File folder = new File(db.getDirectory().getParent(), "folder"); |