diff options
author | Matthias Sohn <matthias.sohn@sap.com> | 2019-09-24 00:14:12 +0200 |
---|---|---|
committer | Matthias Sohn <matthias.sohn@sap.com> | 2019-09-26 15:10:05 +0200 |
commit | cda3b2b49261acaf96629b98feba88acaee3a0b6 (patch) | |
tree | 9489ea7441f9b1237b571565e38fb0f618d0089a /org.eclipse.jgit.test | |
parent | d44a30a27fc813be765ae9adcd610a3efc84eb2f (diff) | |
download | jgit-cda3b2b49261acaf96629b98feba88acaee3a0b6.tar.gz jgit-cda3b2b49261acaf96629b98feba88acaee3a0b6.zip |
Fire WorkingTreeModifiedEvent if cherry-pick failed with conflicts
Otherwise the paths modified by a cherry-pick with conflicts won't be
reported as modified via WorkingTreeModifiedEvents.
Change-Id: I875b67c0d2f68efdf90a9c32b80a2e074ed3570d
Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Signed-off-by: Thomas Wolf <thomas.wolf@paranor.ch>
Diffstat (limited to 'org.eclipse.jgit.test')
-rw-r--r-- | org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java index fbc2cf67e1..adeb8b839c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/CherryPickCommandTest.java @@ -58,6 +58,8 @@ import org.eclipse.jgit.api.errors.GitAPIException; import org.eclipse.jgit.api.errors.JGitInternalException; import org.eclipse.jgit.api.errors.MultipleParentsNotAllowedException; import org.eclipse.jgit.dircache.DirCache; +import org.eclipse.jgit.events.ChangeRecorder; +import org.eclipse.jgit.events.ListenerHandle; import org.eclipse.jgit.junit.RepositoryTestCase; import org.eclipse.jgit.lib.ConfigConstants; import org.eclipse.jgit.lib.Constants; @@ -325,6 +327,25 @@ public class CherryPickCommandTest extends RepositoryTestCase { } @Test + public void testCherryPickConflictFiresModifiedEvent() throws Exception { + ListenerHandle listener = null; + try (Git git = new Git(db)) { + RevCommit sideCommit = prepareCherryPick(git); + ChangeRecorder recorder = new ChangeRecorder(); + listener = db.getListenerList() + .addWorkingTreeModifiedListener(recorder); + CherryPickResult result = git.cherryPick() + .include(sideCommit.getId()).call(); + assertEquals(CherryPickStatus.CONFLICTING, result.getStatus()); + recorder.assertEvent(new String[] { "a" }, ChangeRecorder.EMPTY); + } finally { + if (listener != null) { + listener.remove(); + } + } + } + + @Test public void testCherryPickOurCommitName() throws Exception { try (Git git = new Git(db)) { RevCommit sideCommit = prepareCherryPick(git); |