use of com.google.copybara.git.GitRepository.TreeElement in project copybara by google.
the class GitDestinationReader method copyDestinationFiles.
@Override
public void copyDestinationFiles(Glob glob) throws RepoException {
ImmutableList<TreeElement> treeElements = repository.lsTree(baseline, null, true, true);
PathMatcher pathMatcher = glob.relativeTo(workDir);
for (TreeElement file : treeElements) {
Path path = workDir.resolve(file.getPath());
if (pathMatcher.matches(path)) {
try {
Files.createDirectories(path.getParent());
} catch (IOException e) {
throw new RepoException(String.format("Cannot create parent directory for %s", path), e);
}
}
}
repository.checkout(glob, workDir, baseline);
}
Aggregations