aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobin Stocker2011-05-13 07:39:54 (EDT)
committerRobin Stocker2011-05-13 07:39:54 (EDT)
commita31590ff63bbaad6b99036b32d6cdb4b647e5d6b (patch)
treeb2dc8642c9aeca1d544f63343b23561fe4b8ec81
parent4e7c2f807dea99dfa968d42f221921fc79e41526 (diff)
downloadjgit-a31590ff63bbaad6b99036b32d6cdb4b647e5d6b.zip
jgit-a31590ff63bbaad6b99036b32d6cdb4b647e5d6b.tar.gz
jgit-a31590ff63bbaad6b99036b32d6cdb4b647e5d6b.tar.bz2
RevertCommand: Add "." after reverted commit idrefs/changes/11/3411/1
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>
-rw-r--r--org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java7
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java2
2 files changed, 6 insertions, 3 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java
index 9eb44db..38e7af5 100644
--- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java
+++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/RevertCommandTest.java
@@ -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());
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
index 57c69cc..878d957 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/RevertCommand.java
@@ -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);