diff options
author | Kevin Sawicki <kevin@github.com> | 2012-02-29 10:16:56 -0800 |
---|---|---|
committer | Chris Aniszczyk <zx@twitter.com> | 2012-03-05 20:59:44 -0800 |
commit | 9e4b4fc41c4220779a96afeca17c669f36945721 (patch) | |
tree | 1a602e3e3588dcb52b66c661187d47696b668557 /org.eclipse.jgit.test | |
parent | 8db5414dcf09e62154818b4d8da7d5be07098bb2 (diff) | |
download | jgit-9e4b4fc41c4220779a96afeca17c669f36945721.tar.gz jgit-9e4b4fc41c4220779a96afeca17c669f36945721.zip |
Set person and message on stash ref update
This will be the message and person used for the commit
of stashed working directory changes.
Bug: 372884
Change-Id: I2501b080f6b94e826cf7dba3fd526ae5c1d969d1
Signed-off-by: Chris Aniszczyk <zx@twitter.com>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java index b91a50a945..16fadef153 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashCreateCommandTest.java @@ -54,10 +54,14 @@ import java.util.List; import org.eclipse.jgit.diff.DiffEntry; import org.eclipse.jgit.lib.Constants; +import org.eclipse.jgit.lib.ObjectId; +import org.eclipse.jgit.lib.PersonIdent; import org.eclipse.jgit.lib.Ref; import org.eclipse.jgit.lib.RepositoryTestCase; import org.eclipse.jgit.revwalk.RevCommit; import org.eclipse.jgit.revwalk.RevWalk; +import org.eclipse.jgit.storage.file.ReflogEntry; +import org.eclipse.jgit.storage.file.ReflogReader; import org.eclipse.jgit.treewalk.TreeWalk; import org.eclipse.jgit.treewalk.filter.TreeFilter; import org.eclipse.jgit.util.FileUtils; @@ -394,4 +398,23 @@ public class StashCreateCommandTest extends RepositoryTestCase { assertEquals(DiffEntry.ChangeType.ADD, diffs.get(1).getChangeType()); assertEquals("file2.txt", diffs.get(1).getNewPath()); } + + @Test + public void refLogIncludesCommitMessage() throws Exception { + PersonIdent who = new PersonIdent("user", "user@email.com"); + deleteTrashFile("file.txt"); + RevCommit stashed = git.stashCreate().setPerson(who).call(); + assertNotNull(stashed); + assertEquals("content", read(committedFile)); + validateStashedCommit(stashed); + + ReflogReader reader = new ReflogReader(git.getRepository(), + Constants.R_STASH); + ReflogEntry entry = reader.getLastEntry(); + assertNotNull(entry); + assertEquals(ObjectId.zeroId(), entry.getOldId()); + assertEquals(stashed, entry.getNewId()); + assertEquals(who, entry.getWho()); + assertEquals(stashed.getFullMessage(), entry.getComment()); + } } |