diff options
author | Thomas Wolf <thomas.wolf@paranor.ch> | 2017-01-15 21:35:50 +0100 |
---|---|---|
committer | Thomas Wolf <thomas.wolf@paranor.ch> | 2017-01-15 21:54:12 +0100 |
commit | 46af7192a20bb9d2daf72badc3521320795d44a9 (patch) | |
tree | 261947ca8978abe995367b319d9abda539b9cf99 /org.eclipse.jgit.test | |
parent | d3148f9410b071edd4a4c85d2a43d1fa2574b0d2 (diff) | |
download | jgit-46af7192a20bb9d2daf72badc3521320795d44a9.tar.gz jgit-46af7192a20bb9d2daf72badc3521320795d44a9.zip |
Fix StashApplyCommand for stashes containing untracked changes.
If there are untracked changes, apply only the untracked tree
after a successful merge. The merge tree from merging untracked
with HEAD would also contain files already reset before (changes
in tracked files) and try to reset those again,leading to false
checkout conflicts.
Bug: 505804
Change-Id: Iaced4d277623334d11e3d1cca5969590d7c5093e
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/StashApplyCommandTest.java | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java index ce235a722f..862711571c 100644 --- a/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java +++ b/org.eclipse.jgit.test/tst/org/eclipse/jgit/api/StashApplyCommandTest.java @@ -736,4 +736,21 @@ public class StashApplyCommandTest extends RepositoryTestCase { } assertEquals("working-directory", read(path)); } + + @Test + public void untrackedAndTrackedChanges() throws Exception { + writeTrashFile(PATH, "changed"); + String path = "untracked.txt"; + writeTrashFile(path, "untracked"); + git.stashCreate().setIncludeUntracked(true).call(); + assertTrue(PATH + " should exist", check(PATH)); + assertEquals(PATH + " should have been reset", "content", read(PATH)); + assertFalse(path + " should not exist", check(path)); + git.stashApply().setStashRef("stash@{0}").call(); + assertTrue(PATH + " should exist", check(PATH)); + assertEquals(PATH + " should have new content", "changed", read(PATH)); + assertTrue(path + " should exist", check(path)); + assertEquals(path + " should have new content", "untracked", + read(path)); + } } |