Merge branch 'stable-2.13'
* stable-2.13: Fix gitweb review link Install "git-lfs-authenticate" SSH command when lfs.plugin is configured Introduce "git-lfs-authenticate" SSH Command for LFS plugins Change-Id: I368009619cb8550e059a60e9de9e7ac83e173090
This commit is contained in:
commit
eaee6f44bb
@ -238,10 +238,11 @@ class GitwebServlet extends HttpServlet {
|
||||
p.print(" if (( $secure && $ENV{'SERVER_PORT'} != 443)\n");
|
||||
p.print(" || (!$secure && $ENV{'SERVER_PORT'} != 80)\n");
|
||||
p.print(" );\n");
|
||||
p.print(" $http_url .= qq{$ENV{'GERRIT_CONTEXT_PATH'}};\n");
|
||||
p.print(" my $context = $ENV{'GERRIT_CONTEXT_PATH'};\n");
|
||||
p.print(" chop($context);\n");
|
||||
p.print(" $http_url .= qq{$context};\n");
|
||||
p.print(" $http_url .= qq{/a}\n");
|
||||
p.print(" unless $ENV{'GERRIT_ANONYMOUS_READ'};\n");
|
||||
p.print(" \n");
|
||||
p.print(" push @git_base_url_list, $http_url;\n");
|
||||
p.print("}\n");
|
||||
|
||||
@ -551,7 +552,7 @@ class GitwebServlet extends HttpServlet {
|
||||
env.set("HTTP_" + name.toUpperCase().replace('-', '_'), value);
|
||||
}
|
||||
|
||||
env.set("GERRIT_CONTEXT_PATH", req.getContextPath());
|
||||
env.set("GERRIT_CONTEXT_PATH", req.getContextPath() + "/");
|
||||
env.set("GERRIT_PROJECT_NAME", project.getProject().getName());
|
||||
|
||||
env.set("GITWEB_PROJECTROOT",
|
||||
|
@ -89,6 +89,7 @@ import com.google.gerrit.sshd.SshKeyCacheImpl;
|
||||
import com.google.gerrit.sshd.SshModule;
|
||||
import com.google.gerrit.sshd.commands.DefaultCommandModule;
|
||||
import com.google.gerrit.sshd.commands.IndexCommandsModule;
|
||||
import com.google.gerrit.sshd.plugin.LfsPluginAuthCommand;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.Guice;
|
||||
import com.google.inject.Injector;
|
||||
@ -459,7 +460,8 @@ public class Daemon extends SiteProgram {
|
||||
modules.add(new SshHostKeyModule());
|
||||
}
|
||||
modules.add(new DefaultCommandModule(slave,
|
||||
sysInjector.getInstance(DownloadConfig.class)));
|
||||
sysInjector.getInstance(DownloadConfig.class),
|
||||
sysInjector.getInstance(LfsPluginAuthCommand.Module.class)));
|
||||
if (!slave && indexType == IndexType.LUCENE) {
|
||||
modules.add(new IndexCommandsModule());
|
||||
}
|
||||
|
@ -27,10 +27,13 @@ import com.google.gerrit.sshd.plugin.LfsPluginAuthCommand;
|
||||
/** Register the commands a Gerrit server supports. */
|
||||
public class DefaultCommandModule extends CommandModule {
|
||||
private final DownloadConfig downloadConfig;
|
||||
private final LfsPluginAuthCommand.Module lfsPluginAuthModule;
|
||||
|
||||
public DefaultCommandModule(boolean slave, DownloadConfig downloadCfg) {
|
||||
public DefaultCommandModule(boolean slave, DownloadConfig downloadCfg,
|
||||
LfsPluginAuthCommand.Module module) {
|
||||
slaveMode = slave;
|
||||
downloadConfig = downloadCfg;
|
||||
lfsPluginAuthModule = module;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -124,7 +127,7 @@ public class DefaultCommandModule extends CommandModule {
|
||||
alias(logging, "ls", ListLoggingLevelCommand.class);
|
||||
alias(logging, "set", SetLoggingLevelCommand.class);
|
||||
|
||||
install(new LfsPluginAuthCommand.Module());
|
||||
install(lfsPluginAuthModule);
|
||||
}
|
||||
|
||||
private boolean sshEnabled() {
|
||||
|
@ -16,11 +16,13 @@ package com.google.gerrit.sshd.plugin;
|
||||
|
||||
import com.google.gerrit.extensions.registration.DynamicItem;
|
||||
import com.google.gerrit.server.CurrentUser;
|
||||
import com.google.gerrit.server.config.GerritServerConfig;
|
||||
import com.google.gerrit.sshd.CommandModule;
|
||||
import com.google.gerrit.sshd.SshCommand;
|
||||
import com.google.inject.Inject;
|
||||
import com.google.inject.Provider;
|
||||
|
||||
import org.eclipse.jgit.lib.Config;
|
||||
import org.kohsuke.args4j.Argument;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -33,10 +35,19 @@ public class LfsPluginAuthCommand extends SshCommand {
|
||||
}
|
||||
|
||||
public static class Module extends CommandModule {
|
||||
private final boolean pluginProvided;
|
||||
|
||||
@Inject
|
||||
Module(@GerritServerConfig Config cfg) {
|
||||
pluginProvided = cfg.getString("lfs", null, "plugin") != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure() {
|
||||
command("git-lfs-authenticate").to(LfsPluginAuthCommand.class);
|
||||
DynamicItem.itemOf(binder(), LfsSshPluginAuth.class);
|
||||
if (pluginProvided) {
|
||||
command("git-lfs-authenticate").to(LfsPluginAuthCommand.class);
|
||||
DynamicItem.itemOf(binder(), LfsSshPluginAuth.class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -76,6 +76,7 @@ import com.google.gerrit.sshd.SshKeyCacheImpl;
|
||||
import com.google.gerrit.sshd.SshModule;
|
||||
import com.google.gerrit.sshd.commands.DefaultCommandModule;
|
||||
import com.google.gerrit.sshd.commands.IndexCommandsModule;
|
||||
import com.google.gerrit.sshd.plugin.LfsPluginAuthCommand;
|
||||
import com.google.inject.AbstractModule;
|
||||
import com.google.inject.CreationException;
|
||||
import com.google.inject.Guice;
|
||||
@ -364,7 +365,8 @@ public class WebAppInitializer extends GuiceServletContextListener
|
||||
modules.add(sysInjector.getInstance(SshModule.class));
|
||||
modules.add(new SshHostKeyModule());
|
||||
modules.add(new DefaultCommandModule(false,
|
||||
sysInjector.getInstance(DownloadConfig.class)));
|
||||
sysInjector.getInstance(DownloadConfig.class),
|
||||
sysInjector.getInstance(LfsPluginAuthCommand.Module.class)));
|
||||
if (indexType == IndexType.LUCENE) {
|
||||
modules.add(new IndexCommandsModule());
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user