summaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit
diff options
context:
space:
mode:
authorRobin Rosenberg <robin.rosenberg@dewire.com>2013-04-19 07:36:29 -0400
committerGerrit Code Review @ Eclipse.org <gerrit@eclipse.org>2013-04-19 07:36:29 -0400
commitf37e25e2c3f1322b95ddc6df5fb303d9f54a779a (patch)
tree38131dda083fd20e33a5c4b3aa01b394877baa9a /org.eclipse.jgit
parent427db940ca35476b1567a0f0b1b2959c4c3d19d0 (diff)
parent7a42b7fb95ecd2c132b2588e5ede0f1251772b30 (diff)
downloadjgit-f37e25e2c3f1322b95ddc6df5fb303d9f54a779a.tar.gz
jgit-f37e25e2c3f1322b95ddc6df5fb303d9f54a779a.zip
Merge "Untracked files should not be included in stash"
Diffstat (limited to 'org.eclipse.jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java14
1 files changed, 11 insertions, 3 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 ba56c1a712..fc21b919b6 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashCreateCommand.java
@@ -241,6 +241,7 @@ public class StashCreateCommand extends GitCommand<RevCommit> {
MutableObjectId id = new MutableObjectId();
List<PathEdit> wtEdits = new ArrayList<PathEdit>();
List<String> wtDeletes = new ArrayList<String>();
+ boolean hasChanges = false;
do {
AbstractTreeIterator headIter = treeWalk.getTree(0,
AbstractTreeIterator.class);
@@ -254,9 +255,12 @@ public class StashCreateCommand extends GitCommand<RevCommit> {
new UnmergedPathException(
indexIter.getDirCacheEntry()));
if (wtIter != null) {
- if (indexIter != null && wtIter.idEqual(indexIter)
- || headIter != null
- && wtIter.idEqual(headIter))
+ if (indexIter == null && headIter == null)
+ continue;
+ hasChanges = true;
+ if (indexIter != null && wtIter.idEqual(indexIter))
+ continue;
+ if (headIter != null && wtIter.idEqual(headIter))
continue;
treeWalk.getObjectId(id, 0);
final DirCacheEntry entry = new DirCacheEntry(
@@ -278,10 +282,14 @@ public class StashCreateCommand extends GitCommand<RevCommit> {
}
});
}
+ hasChanges = true;
if (wtIter == null && headIter != null)
wtDeletes.add(treeWalk.getPathString());
} while (treeWalk.next());
+ if (!hasChanges)
+ return null;
+
String branch = Repository.shortenRefName(head.getTarget()
.getName());