diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2019-08-06 18:32:35 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-11-27 03:03:06 +0100 |
commit | 533a81db9d5d6d58e03c54c22e4b7b15d4125095 (patch) | |
tree | 5f5eb5b3c5404e619ca203f03a42ec81b0aca705 /org.eclipse.jgit.pgm.test | |
parent | 59f9d206c954b5633f5978723bd0a2e7db31c2e8 (diff) | |
download | jgit-533a81db9d5d6d58e03c54c22e4b7b15d4125095.tar.gz jgit-533a81db9d5d6d58e03c54c22e4b7b15d4125095.zip |
JGit pgm: Format blame output to match canonical git
Canonical git shows the zero-Id for lines without commit, and
uses the current time stamp for such lines.
Also consider lines without commit when calculating the field
widths.
Change-Id: If0bee9b3e7f90861ad0f387f68e52ecc4a53dfd7
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.pgm.test')
-rw-r--r-- | org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java index 732c54e332..6da1e463f0 100644 --- a/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java +++ b/org.eclipse.jgit.pgm.test/tst/org/eclipse/jgit/pgm/BlameTest.java @@ -48,6 +48,7 @@ import org.eclipse.jgit.api.Git; import org.eclipse.jgit.api.MergeResult; import org.eclipse.jgit.lib.CLIRepositoryTestCase; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.revwalk.RevCommit; import org.junit.Rule; import org.junit.Test; @@ -90,7 +91,7 @@ public class BlameTest extends CLIRepositoryTestCase { git.add().addFilepattern("inIndex.txt").call(); } assertStringArrayEquals( - " (Not Committed Yet 1) index", + "00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 1) index", execute("git blame inIndex.txt")); } @@ -136,22 +137,24 @@ public class BlameTest extends CLIRepositoryTestCase { writeTrashFile("file", "Conflicting change from side branch\n"); git.add().addFilepattern("file").call(); - RevCommit side = git.commit().setMessage("side commit").call(); + RevCommit side = git.commit().setMessage("side commit") + .setCommitter(new PersonIdent("gitter", "")).call(); git.checkout().setName(Constants.MASTER).call(); writeTrashFile("file", "Change on master branch\n"); git.add().addFilepattern("file").call(); - git.commit().setMessage("Commit conflict on master").call(); + git.commit().setMessage("Commit conflict on master") + .setCommitter(new PersonIdent("gitter", "")).call(); MergeResult result = git.merge() .include("side", side).call(); assertTrue("Expected conflict on 'file'", result.getConflicts().containsKey("file")); } String[] expected = { - " (Not Committed Yet 1) <<<<<<< HEAD", - "7a918de5 (GIT_COMMITTER_NAME 2009-08-15 20:12:58 -0330 2) Change on master branch", - " (Not Committed Yet 3) =======", - "beb52f68 (GIT_COMMITTER_NAME 2009-08-15 20:12:58 -0330 4) Conflicting change from side branch", - " (Not Committed Yet 5) >>>>>>> side" }; + "00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 1) <<<<<<< HEAD", + "0f5b671c (gitter 2009-08-15 20:12:58 -0330 2) Change on master branch", + "00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 3) =======", + "ae78cff6 (gitter 2009-08-15 20:12:58 -0330 4) Conflicting change from side branch", + "00000000 (Not Committed Yet 2009-08-15 20:12:58 -0330 5) >>>>>>> side" }; assertArrayOfLinesEquals(expected, execute("git blame file")); } } |