diff options
author | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-04-09 21:22:18 +0200 |
---|---|---|
committer | Robin Rosenberg <robin.rosenberg@dewire.com> | 2013-04-09 21:28:15 +0200 |
commit | 1bede91db21a03ffcaefb8fb31f7c9521b8b331b (patch) | |
tree | 2d3279c23639068ac4c6cc1673447375ace39801 /org.eclipse.jgit | |
parent | 59baf9148e4b16028203d9e881136ab4c005202c (diff) | |
download | jgit-1bede91db21a03ffcaefb8fb31f7c9521b8b331b.tar.gz jgit-1bede91db21a03ffcaefb8fb31f7c9521b8b331b.zip |
Consider working tree changes when stashing newly added files
Bug: 402396
Change-Id: I50ff707c0c9abcab3f98eea21aaa6e824f7af63a
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r-- | org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java index 375dee05c5..ba56c1a712 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java @@ -248,13 +248,15 @@ public class StashCreateCommand extends GitCommand<RevCommit> { DirCacheIterator.class); WorkingTreeIterator wtIter = treeWalk.getTree(2, WorkingTreeIterator.class); - if (headIter != null && indexIter != null && wtIter != null) { - if (!indexIter.getDirCacheEntry().isMerged()) - throw new UnmergedPathsException( - new UnmergedPathException( - indexIter.getDirCacheEntry())); - if (wtIter.idEqual(indexIter) - || wtIter.idEqual(headIter)) + if (indexIter != null + && !indexIter.getDirCacheEntry().isMerged()) + throw new UnmergedPathsException( + new UnmergedPathException( + indexIter.getDirCacheEntry())); + if (wtIter != null) { + if (indexIter != null && wtIter.idEqual(indexIter) + || headIter != null + && wtIter.idEqual(headIter)) continue; treeWalk.getObjectId(id, 0); final DirCacheEntry entry = new DirCacheEntry( @@ -271,14 +273,12 @@ public class StashCreateCommand extends GitCommand<RevCommit> { in.close(); } wtEdits.add(new PathEdit(entry) { - public void apply(DirCacheEntry ent) { ent.copyMetaData(entry); } }); - } else if (indexIter == null) - wtDeletes.add(treeWalk.getPathString()); - else if (wtIter == null && headIter != null) + } + if (wtIter == null && headIter != null) wtDeletes.add(treeWalk.getPathString()); } while (treeWalk.next()); |