diff options
author | Shawn O. Pearce <spearce@spearce.org> | 2010-09-01 09:23:18 -0700 |
---|---|---|
committer | Shawn O. Pearce <spearce@spearce.org> | 2010-09-02 11:38:39 -0700 |
commit | ec2fdbf2bad632bf303ef3d394c957db7588d205 (patch) | |
tree | e03bc9416360748e3be3aa9504040b94bee67101 /org.eclipse.jgit.test | |
parent | 0f5eae53d6ff6ab8390c70232fd238943c264df2 (diff) | |
download | jgit-ec2fdbf2bad632bf303ef3d394c957db7588d205.tar.gz jgit-ec2fdbf2bad632bf303ef3d394c957db7588d205.zip |
Move rename detection, path following into DiffFormatter
Applications just want a quick way to configure our diff
implementation, and then just want to use it without a lot of fuss.
Move all of the rename detection logic and path following logic
out of our pgm package and into DiffFormatter itself, making it
much easier for a GUI to take advantage of the features without
duplicating a lot of code.
Change-Id: I4b54e987bb6dc804fb270cbc495fe4cae26c7b0e
Signed-off-by: Shawn O. Pearce <spearce@spearce.org>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/diff/DiffFormatterTest.java | 17 |
1 files changed, 12 insertions, 5 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 d7a10e4b15..eefbefb071 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 @@ -77,10 +77,17 @@ public class DiffFormatterTest extends RepositoryTestCase { df.setAbbreviationLength(8); } + @Override + public void tearDown() throws Exception { + if (df != null) + df.release(); + super.tearDown(); + } + public void testCreateFileHeader_Add() throws Exception { ObjectId adId = blob("a\nd\n"); DiffEntry ent = DiffEntry.add("FOO", adId); - FileHeader fh = df.createFileHeader(ent); + FileHeader fh = df.toFileHeader(ent); String diffHeader = "diff --git a/FOO b/FOO\n" // + "new file mode " + REGULAR_FILE + "\n" @@ -115,7 +122,7 @@ public class DiffFormatterTest extends RepositoryTestCase { public void testCreateFileHeader_Delete() throws Exception { ObjectId adId = blob("a\nd\n"); DiffEntry ent = DiffEntry.delete("FOO", adId); - FileHeader fh = df.createFileHeader(ent); + FileHeader fh = df.toFileHeader(ent); String diffHeader = "diff --git a/FOO b/FOO\n" // + "deleted file mode " + REGULAR_FILE + "\n" @@ -158,7 +165,7 @@ public class DiffFormatterTest extends RepositoryTestCase { DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 0); - FileHeader fh = df.createFileHeader(mod); + FileHeader fh = df.toFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); assertEquals(0, fh.getStartOffset()); @@ -193,7 +200,7 @@ public class DiffFormatterTest extends RepositoryTestCase { DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 0); - FileHeader fh = df.createFileHeader(mod); + FileHeader fh = df.toFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); assertEquals(FileHeader.PatchType.BINARY, fh.getPatchType()); @@ -218,7 +225,7 @@ public class DiffFormatterTest extends RepositoryTestCase { DiffEntry mod = DiffEntry.pair(ChangeType.MODIFY, ad, abcd, 0); - FileHeader fh = df.createFileHeader(mod); + FileHeader fh = df.toFileHeader(mod); assertEquals(diffHeader, RawParseUtils.decode(fh.getBuffer())); |