Browse Source

CleanCommand include child dirs

Signed-off-by: qxo <qxodream@gmail.com>
pull/37/head
qxo 7 years ago
parent
commit
6b4de1a460
1 changed files with 17 additions and 2 deletions
  1. 17
    2
      org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java

+ 17
- 2
org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java View File

@@ -142,8 +142,23 @@ public class CleanCommand extends GitCommand<Set<String>> {
if(paths.isEmpty()){
return false;
}
int idx = file.lastIndexOf("/");
return idx == -1 ? false : paths.contains(file.substring(0,idx));
String path=file;
final Set<String> dirs = new HashSet<String>();
while(true){
int idx = path.lastIndexOf("/");
if( idx> 0 ){
path=file.substring(0,idx);
if(paths.contains(path)){
paths.addAll(dirs);
return true;
}
dirs.add(path);
}else{
break;
}
return idx == -1 ? false : ;
}
return false;
}
/**

Loading…
Cancel
Save