aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
diff options
context:
space:
mode:
authorShawn Pearce <sop@google.com>2014-11-24 11:51:32 -0800
committerShawn Pearce <sop@google.com>2014-11-24 12:59:45 -0800
commitb88f3a2a2c598958865027c1d2d0adbf89a2db69 (patch)
treeae54e207dee8d4ad85f7b4ef07f81164c86bb589 /org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
parent3bc51889000bd9e3b52203ccdab5f0f77b7100ea (diff)
downloadjgit-b88f3a2a2c598958865027c1d2d0adbf89a2db69.tar.gz
jgit-b88f3a2a2c598958865027c1d2d0adbf89a2db69.zip
Cleanup TreeWalk creation/release inside StashApplyCommand
The TreeWalk constructor doesn't throw in a meaninful way that requires cleanup of the not-yet-created TreeWalk. Hoist the constructor outside of the try/finally and remove the now unnecessary != null check during the finally. Change-Id: If5b8bb91562715df0699726648123a47426b9850
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java6
1 files changed, 2 insertions, 4 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
index 4d54e0be97..5d0ac2f2da 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/StashApplyCommand.java
@@ -329,9 +329,8 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
private void resetUntracked(RevTree tree) throws CheckoutConflictException,
IOException {
- TreeWalk walk = null;
+ TreeWalk walk = new TreeWalk(repo); // maybe NameConflictTreeWalk;
try {
- walk = new TreeWalk(repo); // maybe NameConflictTreeWalk?
walk.addTree(tree);
walk.addTree(new FileTreeIterator(repo));
walk.setRecursive(true);
@@ -362,8 +361,7 @@ public class StashApplyCommand extends GitCommand<ObjectId> {
checkoutPath(entry, reader);
}
} finally {
- if (walk != null)
- walk.release();
+ walk.release();
}
}