aboutsummaryrefslogtreecommitdiffstats
path: root/org.eclipse.jgit/src/org/eclipse/jgit
diff options
context:
space:
mode:
Diffstat (limited to 'org.eclipse.jgit/src/org/eclipse/jgit')
-rw-r--r--org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java11
1 files changed, 6 insertions, 5 deletions
diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
index a3c8e5c939..d0d40c4679 100644
--- a/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
+++ b/org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java
@@ -47,6 +47,7 @@ import java.io.File;
import java.io.IOException;
import java.util.Collections;
import java.util.Set;
+import java.util.TreeSet;
import org.eclipse.jgit.api.errors.JGitInternalException;
import org.eclipse.jgit.lib.Repository;
@@ -79,15 +80,15 @@ public class CleanCommand extends GitCommand<Set<String>> {
* @return a set of strings representing each file cleaned.
*/
public Set<String> call() {
- Set<String> files = Collections.emptySet();
+ Set<String> files = new TreeSet<String>();
try {
StatusCommand command = new StatusCommand(repo);
Status status = command.call();
- files = status.getUntracked();
-
- for (String file : files) {
- if (paths.isEmpty() || paths.contains(file))
+ for (String file : status.getUntracked()) {
+ if (paths.isEmpty() || paths.contains(file)) {
FileUtils.delete(new File(repo.getWorkTree(), file));
+ files.add(file);
+ }
}
} catch (IOException e) {
throw new JGitInternalException(e.getMessage(), e);