diff --git a/Documentation/config-gerrit.txt b/Documentation/config-gerrit.txt index fcc6eca89f..3dcee80a27 100644 --- a/Documentation/config-gerrit.txt +++ b/Documentation/config-gerrit.txt @@ -5687,10 +5687,10 @@ and "never" suppresses expiration altogether. [[protocol.version]]protocol.version:: + If set, the server will accept requests from a client attempting to communicate -using the specified protocol version. Otherwise communication falls back to version 0. -If set in file `etc/jgit.config` this option will be used for all repositories of -the site. It can be overridden for a given repository by configuring a different -value in the repository's `config` file. +using the specified protocol version. Default is `2`. If set in file +`etc/jgit.config` this option will be used for all repositories of the site. +It can be overridden for a given repository by configuring a different value in +the repository's `config` file. + Supported versions: 0:: the original wire protocol. diff --git a/java/com/google/gerrit/pgm/init/InitJGitConfig.java b/java/com/google/gerrit/pgm/init/InitJGitConfig.java index 6e37f7f909..bad55b4c5f 100644 --- a/java/com/google/gerrit/pgm/init/InitJGitConfig.java +++ b/java/com/google/gerrit/pgm/init/InitJGitConfig.java @@ -64,22 +64,9 @@ class InitJGitConfig implements InitStep { + "gc should be configured in gc config section or run as a separate process."); } - if (!jgitConfig + if (jgitConfig .getNames(ConfigConstants.CONFIG_PROTOCOL_SECTION) .contains(ConfigConstants.CONFIG_KEY_VERSION)) { - jgitConfig.setString( - ConfigConstants.CONFIG_PROTOCOL_SECTION, - null, - ConfigConstants.CONFIG_KEY_VERSION, - TransferConfig.ProtocolVersion.V2.version()); - jgitConfig.save(); - ui.error( - String.format( - "Auto-configured \"%s.%s = %s\" to activate git wire protocol version 2.", - ConfigConstants.CONFIG_PROTOCOL_SECTION, - ConfigConstants.CONFIG_KEY_VERSION, - TransferConfig.ProtocolVersion.V2.version())); - } else { String version = jgitConfig.getString( ConfigConstants.CONFIG_PROTOCOL_SECTION, null, ConfigConstants.CONFIG_KEY_VERSION); diff --git a/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java b/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java index b52fcf46c2..f9df37560f 100644 --- a/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java +++ b/javatests/com/google/gerrit/integration/git/GitProtocolV2IT.java @@ -42,7 +42,6 @@ import com.google.inject.Inject; import java.io.File; import java.net.InetSocketAddress; import org.eclipse.jgit.lib.Config; -import org.eclipse.jgit.lib.Constants; import org.junit.BeforeClass; import org.junit.Test; @@ -98,11 +97,6 @@ public class GitProtocolV2IT extends StandaloneSiteTest { .group(SystemGroupBackend.REGISTERED_USERS)) .update(); - // Set protocol.version=2 in target repository - execute( - ImmutableList.of("git", "config", "protocol.version", "2"), - sitePaths.site_path.resolve("git").resolve(project.get() + Constants.DOT_GIT).toFile()); - // Retrieve HTTP url String url = config.getString("gerrit", null, "canonicalweburl"); String urlDestinationTemplate = @@ -217,15 +211,6 @@ public class GitProtocolV2IT extends StandaloneSiteTest { Project.NameKey allRefsVisibleProject = Project.nameKey("all-refs-visible"); gApi.projects().create(allRefsVisibleProject.get()); - // Set protocol.version=2 in target repository - execute( - ImmutableList.of("git", "config", "protocol.version", "2"), - sitePaths - .site_path - .resolve("git") - .resolve(allRefsVisibleProject.get() + Constants.DOT_GIT) - .toFile()); - // Set up project permission to allow reading all refs projectOperations .project(allRefsVisibleProject) @@ -280,15 +265,6 @@ public class GitProtocolV2IT extends StandaloneSiteTest { Project.NameKey privateProject = Project.nameKey("private-project"); gApi.projects().create(privateProject.get()); - // Set protocol.version=2 in target repository - execute( - ImmutableList.of("git", "config", "protocol.version", "2"), - sitePaths - .site_path - .resolve("git") - .resolve(privateProject.get() + Constants.DOT_GIT) - .toFile()); - // Disallow general read permissions for anonymous users projectOperations .project(allProjectsName)