CPP-19906: Remote host sync silently hangs: recursive symlinks in header paths.

GitOrigin-RevId: 3a59d2f6255fad010c3c0f16c72d0fa676788725
This commit is contained in:
Vasily Romanikhin
2020-05-11 13:52:49 +00:00
committed by intellij-monorepo-bot
parent cad68898e2
commit cbf064aacd
@@ -205,6 +205,7 @@ public abstract class Decompressor {
}
@Nullable private Condition<? super String> myFilter = null;
@Nullable private Condition<? super Entry> myEntryFilter = null;
@Nullable private List<String> myPathsPrefix = null;
private boolean myOverwrite = true;
@Nullable private Consumer<? super File> myConsumer;
@@ -214,6 +215,11 @@ public abstract class Decompressor {
return this;
}
public Decompressor filterEntries(@Nullable Condition<? super Entry> filter) {
myEntryFilter = filter;
return this;
}
public Decompressor overwrite(boolean overwrite) {
myOverwrite = overwrite;
return this;
@@ -252,6 +258,10 @@ public abstract class Decompressor {
}
}
if (myEntryFilter != null && !myEntryFilter.value(entry)) {
continue;
}
if (myPathsPrefix != null) {
entry = entry.mapPathPrefix(myPathsPrefix);
if (entry == null) continue;
@@ -308,14 +318,14 @@ public abstract class Decompressor {
//<editor-fold desc="Internal interface">
protected Decompressor() { }
private enum Type {FILE, DIR, SYMLINK}
public enum Type {FILE, DIR, SYMLINK}
protected static class Entry {
final String name;
final Type type;
final boolean isWritable;
final boolean isExecutable;
final String linkTarget;
public static class Entry {
public final String name;
public final Type type;
public final boolean isWritable;
public final boolean isExecutable;
public final String linkTarget;
protected Entry(String name, boolean isDirectory) {
this(name, isDirectory ? Type.DIR : Type.FILE, true, false, null);