RevertCommand: Add "." after reverted commit id

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>
This commit is contained in:
Robin Stocker 2011-05-13 13:39:54 +02:00
parent 4e7c2f807d
commit a31590ff63
2 changed files with 6 additions and 3 deletions

View File

@ -55,7 +55,7 @@
import org.junit.Test;
/**
* Test cherry-pick command
* Test revert command
*/
public class RevertCommandTest extends RepositoryTestCase {
@Test
@ -90,7 +90,10 @@ public void testRevert() throws IOException, JGitInternalException,
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());

View File

@ -149,7 +149,7 @@ public RevCommit call() throws GitAPIException {
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);