]> source.dussan.org Git - jgit.git/commitdiff
RevertCommand: Add "." after reverted commit id 11/3411/1
authorRobin Stocker <robin@nibor.org>
Fri, 13 May 2011 11:39:54 +0000 (13:39 +0200)
committerRobin Stocker <robin@nibor.org>
Fri, 13 May 2011 11:39:54 +0000 (13:39 +0200)
This makes the message look the same as in C Git (the "."):

  This reverts commit <sha1>.

Change-Id: I4c254c122277b127e7b039c0d1c7f7a0d691530d
Signed-off-by: Robin Stocker <robin@nibor.org>
org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java
org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java

index 9eb44db8661b0e83de64a29491abb67207865b1c..38e7af50faff65e519492b9aca977aca92322799 100644 (file)
@@ -55,7 +55,7 @@ import org.eclipse.jgit.revwalk.RevCommit;
 import org.junit.Test;
 
 /**
- * Test cherry-pick command
+ * Test revert command
  */
 public class RevertCommandTest extends RepositoryTestCase {
        @Test
@@ -90,7 +90,10 @@ public class RevertCommandTest extends RepositoryTestCase {
                checkFile(new File(db.getWorkTree(), "a"),
                                "first line\nsec. line\nthird line\nfourth line\n");
                Iterator<RevCommit> history = git.log().call().iterator();
-               assertEquals("Revert \"fixed a\"", history.next().getShortMessage());
+               RevCommit revertCommit = history.next();
+               String expectedMessage = "Revert \"fixed a\"\n\n"
+                               + "This reverts commit " + fixingA.getId().getName() + ".\n";
+               assertEquals(expectedMessage, revertCommit.getFullMessage());
                assertEquals("fixed b", history.next().getFullMessage());
                assertEquals("fixed a", history.next().getFullMessage());
                assertEquals("enlarged a", history.next().getFullMessage());
index 57c69cc08a82d5115cef241d69d9f30e8efd0f4b..878d9577062f9a4988ab12b3c90dcf5444598b7e 100644 (file)
@@ -149,7 +149,7 @@ public class RevertCommand extends GitCommand<RevCommit> {
                                        String newMessage = "Revert \""
                                                        + srcCommit.getShortMessage() + "\"" + "\n\n"
                                                        + "This reverts commit "
-                                                       + srcCommit.getId().getName() + "\n";
+                                                       + srcCommit.getId().getName() + ".\n";
                                        newHead = new Git(getRepository()).commit().setMessage(
                                                        newMessage).call();
                                        revertedRefs.add(src);