import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
+import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import org.eclipse.jgit.lib.Repository;
return filterCommandRegistry.containsKey(filterCommandName);
}
+ /**
+ * @return Set of commandNames for which a {@link FilterCommandFactory} is
+ * registered
+ */
+ public static Set<String> getRegisteredFilterCommands() {
+ return filterCommandRegistry.keySet();
+ }
+
/**
* Creates a new {@link FilterCommand} for the given name. A factory must be
* registered for the name in advance.
import org.eclipse.jgit.attributes.Attributes;
import org.eclipse.jgit.attributes.AttributesNodeProvider;
import org.eclipse.jgit.attributes.AttributesProvider;
+import org.eclipse.jgit.attributes.FilterCommandRegistry;
import org.eclipse.jgit.dircache.DirCacheBuildIterator;
import org.eclipse.jgit.attributes.AttributesHandler;
import org.eclipse.jgit.dircache.DirCacheIterator;
private Config config;
+ private Set<String> filterCommands;
+
/**
* Create a new tree walker for a given repository.
*
if (repo != null) {
config = repo.getConfig();
attributesNodeProvider = repo.createAttributesNodeProvider();
+ filterCommands = FilterCommandRegistry
+ .getRegisteredFilterCommands();
} else {
config = null;
attributesNodeProvider = null;
return filterCommand;
filterCommand = config.getString(Constants.ATTR_FILTER,
filterDriverName, filterCommandType);
- if (filterCommand != null)
+ boolean useBuiltin = config.getBoolean(Constants.ATTR_FILTER,
+ filterDriverName, Constants.ATTR_FILTER_USE_BUILTIN, false);
+ if (useBuiltin) {
+ String builtinFilterCommand = Constants.BUILTIN_FILTER_PREFIX
+ + filterDriverName + '/' + filterCommandType;
+ if (filterCommands != null
+ && filterCommands.contains(builtinFilterCommand)) {
+ filterCommand = builtinFilterCommand;
+ }
+ }
+ if (filterCommand != null) {
filterCommandsByNameDotType.put(key, filterCommand);
+ }
return filterCommand;
}
}