Ver código fonte

fixed for clean with dir path

Signed-off-by: qxo <qxodream@gmail.com>
pull/37/head
qxo 7 anos atrás
pai
commit
e8d6182d39

+ 12
- 4
org.eclipse.jgit/src/org/eclipse/jgit/api/CleanCommand.java Ver arquivo

status.getIgnoredNotInIndex(), false); status.getIgnoredNotInIndex(), false);


for (String file : notIgnoredFiles) for (String file : notIgnoredFiles)
if (paths.isEmpty() || paths.contains(file)) {
if (paths.isEmpty() || paths.contains(file) || isFileInPaths(file) ) {
files = cleanPath(file, files); files = cleanPath(file, files);
} }
for (String dir : notIgnoredDirs) for (String dir : notIgnoredDirs)
if (paths.isEmpty() || paths.contains(dir)) {
if (paths.isEmpty() || paths.contains(dir) || isFileInPaths(dir) ) {
files = cleanPath(dir, files); files = cleanPath(dir, files);
} }
} catch (IOException e) { } catch (IOException e) {
} }
return files; return files;
} }

protected boolean isFileInPaths(final String file) {
if(paths.isEmpty()){
return false;
}
int idx = file.lastIndexOf("/");
return idx == -1 ? false : paths.contains(file.substring(0,idx));
}
/** /**
* When dryRun is false, deletes the specified path from disk. If dryRun * When dryRun is false, deletes the specified path from disk. If dryRun
* is true, no paths are actually deleted. In both cases, the paths that * is true, no paths are actually deleted. In both cases, the paths that

Carregando…
Cancelar
Salvar