diff --git a/grgit-core/src/main/groovy/org/ajoberstar/grgit/auth/GrgitSystemReader.java b/grgit-core/src/main/groovy/org/ajoberstar/grgit/auth/GrgitSystemReader.java index dee25c5d..a9ed3195 100644 --- a/grgit-core/src/main/groovy/org/ajoberstar/grgit/auth/GrgitSystemReader.java +++ b/grgit-core/src/main/groovy/org/ajoberstar/grgit/auth/GrgitSystemReader.java @@ -4,39 +4,28 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; -import java.text.DateFormat; -import java.text.SimpleDateFormat; -import java.util.*; +import java.util.Collections; +import java.util.List; +import java.util.Optional; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; import java.util.stream.Stream; -import org.eclipse.jgit.errors.CorruptObjectException; -import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.storage.file.FileBasedConfig; -import org.eclipse.jgit.util.FS; import org.eclipse.jgit.util.SystemReader; -import org.eclipse.jgit.util.time.MonotonicClock; -public class GrgitSystemReader extends SystemReader { +public class GrgitSystemReader extends SystemReader.Delegate { private static final Pattern PATH_SPLITTER = Pattern.compile(Pattern.quote(File.pathSeparator)); - private final SystemReader delegate; private final String gitSsh; public GrgitSystemReader(SystemReader delegate, String gitSsh) { - this.delegate = delegate; + super(delegate); this.gitSsh = gitSsh; } - @Override - public String getHostname() { - return delegate.getHostname(); - } - @Override public String getenv(String variable) { - String value = delegate.getenv(variable); + String value = super.getenv(variable); if ("GIT_SSH".equals(variable) && value == null) { return gitSsh; } else { @@ -44,86 +33,6 @@ public String getenv(String variable) { } } - @Override - public String getProperty(String key) { - return delegate.getProperty(key); - } - - @Override - public FileBasedConfig openJGitConfig(Config parent, FS fs) { - return delegate.openJGitConfig(parent, fs); - } - - @Override - public FileBasedConfig openUserConfig(Config parent, FS fs) { - return delegate.openUserConfig(parent, fs); - } - - @Override - public FileBasedConfig openSystemConfig(Config parent, FS fs) { - return delegate.openSystemConfig(parent, fs); - } - - @Override - public long getCurrentTime() { - return delegate.getCurrentTime(); - } - - @Override - public MonotonicClock getClock() { - return delegate.getClock(); - } - - @Override - public int getTimezone(long when) { - return delegate.getTimezone(when); - } - - @Override - public TimeZone getTimeZone() { - return delegate.getTimeZone(); - } - - @Override - public Locale getLocale() { - return delegate.getLocale(); - } - - @Override - public SimpleDateFormat getSimpleDateFormat(String pattern) { - return delegate.getSimpleDateFormat(pattern); - } - - @Override - public SimpleDateFormat getSimpleDateFormat(String pattern, Locale locale) { - return delegate.getSimpleDateFormat(pattern, locale); - } - - @Override - public DateFormat getDateTimeInstance(int dateStyle, int timeStyle) { - return delegate.getDateTimeInstance(dateStyle, timeStyle); - } - - @Override - public boolean isWindows() { - return delegate.isWindows(); - } - - @Override - public boolean isMacOS() { - return delegate.isWindows(); - } - - @Override - public void checkPath(String path) throws CorruptObjectException { - delegate.checkPath(path); - } - - @Override - public void checkPath(byte[] path) throws CorruptObjectException { - delegate.checkPath(path); - } - public static void install() { SystemReader current = SystemReader.getInstance();