Allow to inherit receive.maxObjectSizeLimit from parent project
In the current implementation it is possible to set the limit per
project in the project.config on refs/meta/config, and at global
level in $site/etc/gerrit.config. The project setting may override
the global setting if it is lower. Changing the global setting
requires a server restart.
A limitation of this implementation is that we cannot set the limit
at a project level and have it inherited to its child projects; it
is necessary to explicitly set the limit on each child project.
This limitation causes a lot of extra work in the case where for
example we have a project hierarchy like:
|- All-Projects
|
-- Namespace-A
| |
| |-- Project-A
| |-- Project-B
. . ..
. . ..
| |-- Project-X
|
|
-- Namespace-B
Where the Namespace-X projects are assumed to be "parent only"
projects, if we want to set a limit for all the projects under a
namespace hierarchy, we need to set it explicitly on all those
projects individually rather than only on the "Namespace-X".
With this change the limit is inherited from the parent project.
The global limit is still respected, and the project still can't
set a higher value than the global, either explicitly per project
or via inheritance.
Similarly, if no global limit is specified, a child project still
may not set a limit higher than its parent.
The inheritedValue is removed from the config info and replaced
by a summary string describing how the effective value was
inherited or overridden from the parent project or the global
config. This string is used as the tooltip on the effective
value in the UI.
As a side effect of this change, it is now possible to effectively
change the global limit without having to restart the server, by
setting it on the All-Projects project. Note that this only works
if the new limit is lower than what is already configured in the
actual global limit in gerrit.config.
Bug: Issue 9528
Change-Id: I5f8b333e905ed0a147526ae33ff2bab2cbe222ef
diff --git a/Documentation/rest-api-projects.txt b/Documentation/rest-api-projects.txt
index eee3151..8e151bc 100644
--- a/Documentation/rest-api-projects.txt
+++ b/Documentation/rest-api-projects.txt
@@ -2812,10 +2812,10 @@
formatted string. +
Not set if there is no limit for the object size configured on project
level.
-|`inherited_value` |optional|
-The max object size limit that is inherited from the global config as a
-formatted string. +
-Not set if there is no global limit for the object size.
+|`summary` |optional|
+A string describing whether the value was inherited or overridden from
+the parent project or global config. +
+Not set if not inherited or overridden.
|===============================
[[project-access-input]]
diff --git a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java
index 7c62302..5f97a44 100644
--- a/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java
+++ b/gerrit-acceptance-tests/src/test/java/com/google/gerrit/acceptance/api/project/ProjectIT.java
@@ -16,6 +16,10 @@
import static com.google.common.truth.Truth.assertThat;
import static com.google.gerrit.server.group.SystemGroupBackend.ANONYMOUS_USERS;
+import static com.google.gerrit.server.project.ProjectState.INHERITED_FROM_GLOBAL;
+import static com.google.gerrit.server.project.ProjectState.INHERITED_FROM_PARENT;
+import static com.google.gerrit.server.project.ProjectState.OVERRIDDEN_BY_GLOBAL;
+import static com.google.gerrit.server.project.ProjectState.OVERRIDDEN_BY_PARENT;
import com.google.gerrit.acceptance.AbstractDaemonTest;
import com.google.gerrit.acceptance.GerritConfig;
@@ -144,7 +148,7 @@
ConfigInfo info = getConfig();
assertThat(info.maxObjectSizeLimit.value).isNull();
assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
- assertThat(info.maxObjectSizeLimit.inheritedValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
}
@Test
@@ -153,37 +157,91 @@
ConfigInfo info = setMaxObjectSize("100k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
- assertThat(info.maxObjectSizeLimit.inheritedValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
// Clear the value
info = setMaxObjectSize("0");
assertThat(info.maxObjectSizeLimit.value).isNull();
assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
- assertThat(info.maxObjectSizeLimit.inheritedValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
}
@Test
- public void maxObjectSizeIsNotInheritedFromParentProject() throws Exception {
+ public void maxObjectSizeIsInheritedFromParentProject() throws Exception {
Project.NameKey child = createProject(name("child"), project);
ConfigInfo info = setMaxObjectSize("100k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
- assertThat(info.maxObjectSizeLimit.inheritedValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
info = getConfig(child);
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary)
+ .isEqualTo(String.format(INHERITED_FROM_PARENT, project));
+ }
+
+ @Test
+ public void maxObjectSizeOverridesParentProjectWhenNotSetOnParent() throws Exception {
+ Project.NameKey child = createProject(name("child"), project);
+
+ ConfigInfo info = setMaxObjectSize("0");
assertThat(info.maxObjectSizeLimit.value).isNull();
assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
- assertThat(info.maxObjectSizeLimit.inheritedValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+
+ info = setMaxObjectSize(child, "100k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+ }
+
+ @Test
+ public void maxObjectSizeOverridesParentProjectWhenLower() throws Exception {
+ Project.NameKey child = createProject(name("child"), project);
+
+ ConfigInfo info = setMaxObjectSize("200k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("200k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+
+ info = setMaxObjectSize(child, "100k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+ }
+
+ @Test
+ public void maxObjectSizeDoesNotOverrideParentProjectWhenHigher() throws Exception {
+ Project.NameKey child = createProject(name("child"), project);
+
+ ConfigInfo info = setMaxObjectSize("100k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+
+ info = setMaxObjectSize(child, "200k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("200k");
+ assertThat(info.maxObjectSizeLimit.summary)
+ .isEqualTo(String.format(OVERRIDDEN_BY_PARENT, project));
}
@Test
@GerritConfig(name = "receive.maxObjectSizeLimit", value = "200k")
public void maxObjectSizeIsInheritedFromGlobalConfig() throws Exception {
+ Project.NameKey child = createProject(name("child"), project);
+
ConfigInfo info = getConfig();
assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
- assertThat(info.maxObjectSizeLimit.inheritedValue).isEqualTo("200k");
+ assertThat(info.maxObjectSizeLimit.summary).isEqualTo(INHERITED_FROM_GLOBAL);
+
+ info = getConfig(child);
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isEqualTo(INHERITED_FROM_GLOBAL);
}
@Test
@@ -192,16 +250,39 @@
ConfigInfo info = setMaxObjectSize("100k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
- assertThat(info.maxObjectSizeLimit.inheritedValue).isEqualTo("200k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+ }
+
+ @Test
+ @GerritConfig(name = "receive.maxObjectSizeLimit", value = "300k")
+ public void inheritedMaxObjectSizeOverridesGlobalConfigWhenLower() throws Exception {
+ Project.NameKey child = createProject(name("child"), project);
+
+ ConfigInfo info = setMaxObjectSize("200k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("200k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
+
+ info = setMaxObjectSize(child, "100k");
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("102400");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("100k");
+ assertThat(info.maxObjectSizeLimit.summary).isNull();
}
@Test
@GerritConfig(name = "receive.maxObjectSizeLimit", value = "200k")
public void maxObjectSizeDoesNotOverrideGlobalConfigWhenHigher() throws Exception {
+ Project.NameKey child = createProject(name("child"), project);
+
ConfigInfo info = setMaxObjectSize("300k");
assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
assertThat(info.maxObjectSizeLimit.configuredValue).isEqualTo("300k");
- assertThat(info.maxObjectSizeLimit.inheritedValue).isEqualTo("200k");
+ assertThat(info.maxObjectSizeLimit.summary).isEqualTo(OVERRIDDEN_BY_GLOBAL);
+
+ info = getConfig(child);
+ assertThat(info.maxObjectSizeLimit.value).isEqualTo("204800");
+ assertThat(info.maxObjectSizeLimit.configuredValue).isNull();
+ assertThat(info.maxObjectSizeLimit.summary).isEqualTo(OVERRIDDEN_BY_GLOBAL);
}
@Test
@@ -220,9 +301,13 @@
}
private ConfigInfo setMaxObjectSize(String value) throws Exception {
+ return setMaxObjectSize(project, value);
+ }
+
+ private ConfigInfo setMaxObjectSize(Project.NameKey name, String value) throws Exception {
ConfigInput input = new ConfigInput();
input.maxObjectSizeLimit = value;
- return setConfig(input);
+ return setConfig(name, input);
}
private ConfigInfo getConfig(Project.NameKey name) throws Exception {
diff --git a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java
index 09ad328..36c86ed 100644
--- a/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java
+++ b/gerrit-extension-api/src/main/java/com/google/gerrit/extensions/api/projects/ConfigInfo.java
@@ -48,14 +48,17 @@
}
public static class MaxObjectSizeLimitInfo {
- /* The effective value. Null if not set. */
+ /** The effective value in bytes. Null if not set. */
@Nullable public String value;
- /* The value configured on the project. Null if not set. */
+ /** The value configured explicitly on the project as a formatted string. Null if not set. */
@Nullable public String configuredValue;
- /* The value configured globally. Null if not set. */
- @Nullable public String inheritedValue;
+ /**
+ * Whether the value was inherited or overridden from the project's parent hierarchy or global
+ * config. Null if not inherited or overridden.
+ */
+ @Nullable public String summary;
}
public static class ConfigParameterInfo {
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java
index fe27e9c..7b18a39 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.java
@@ -36,8 +36,6 @@
String effectiveMaxObjectSizeLimit(String effectiveMaxObjectSizeLimit);
- String globalMaxObjectSizeLimit(String globalMaxObjectSizeLimit);
-
String noMaxObjectSizeLimit();
String pluginProjectOptionsTitle(String pluginName);
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties
index f746365..c9aa987 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/AdminMessages.properties
@@ -6,7 +6,6 @@
deletedReference = Reference {0} was deleted
deletedSection = Section {0} was deleted
effectiveMaxObjectSizeLimit = effective: {0} bytes
-globalMaxObjectSizeLimit = The global max object size limit is set to {0}. The limit cannot be increased on project level.
noMaxObjectSizeLimit = No max object size limit is set.
pluginProjectOptionsTitle = {0} Plugin Options
pluginProjectOptionsTitle = {0} Plugin
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java
index 0e185eb..2e4054e 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/admin/ProjectInfoScreen.java
@@ -404,9 +404,8 @@
if (result.maxObjectSizeLimit().value() != null) {
effectiveMaxObjectSizeLimit.setText(
AdminMessages.I.effectiveMaxObjectSizeLimit(result.maxObjectSizeLimit().value()));
- if (result.maxObjectSizeLimit().inheritedValue() != null) {
- effectiveMaxObjectSizeLimit.setTitle(
- AdminMessages.I.globalMaxObjectSizeLimit(result.maxObjectSizeLimit().inheritedValue()));
+ if (result.maxObjectSizeLimit().summary() != null) {
+ effectiveMaxObjectSizeLimit.setTitle(result.maxObjectSizeLimit().summary());
}
} else {
effectiveMaxObjectSizeLimit.setText(AdminMessages.I.noMaxObjectSizeLimit());
diff --git a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java
index 738319d..c96d331 100644
--- a/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java
+++ b/gerrit-gwtui/src/main/java/com/google/gerrit/client/projects/ConfigInfo.java
@@ -158,10 +158,10 @@
public static class MaxObjectSizeLimitInfo extends JavaScriptObject {
public final native String value() /*-{ return this.value; }-*/;
- public final native String inheritedValue() /*-{ return this.inherited_value; }-*/;
-
public final native String configuredValue() /*-{ return this.configured_value }-*/;
+ public final native String summary() /*-{ return this.summary; }-*/;
+
protected MaxObjectSizeLimitInfo() {}
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
index cd97464..4bd51cf 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/git/ReceiveCommits.java
@@ -446,7 +446,8 @@
rp.setAllowNonFastForwards(true);
rp.setRefLogIdent(user.newRefLogIdent());
rp.setTimeout(transferConfig.getTimeout());
- rp.setMaxObjectSizeLimit(projectControl.getProjectState().getEffectiveMaxObjectSizeLimit());
+ rp.setMaxObjectSizeLimit(
+ projectControl.getProjectState().getEffectiveMaxObjectSizeLimit().value);
rp.setCheckReceivedObjects(ps.getConfig().getCheckReceivedObjects());
rp.setRefFilter(
new RefFilter() {
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java
index 24760b7..62b8c9d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ConfigInfoImpl.java
@@ -30,7 +30,7 @@
import com.google.gerrit.server.config.PluginConfigFactory;
import com.google.gerrit.server.config.ProjectConfigEntry;
import com.google.gerrit.server.extensions.webui.UiActions;
-import com.google.gerrit.server.git.TransferConfig;
+import com.google.gerrit.server.project.ProjectState.EffectiveMaxObjectSizeLimit;
import com.google.inject.util.Providers;
import java.util.Arrays;
import java.util.LinkedHashMap;
@@ -41,7 +41,6 @@
public ConfigInfoImpl(
boolean serverEnableSignedPush,
ProjectControl control,
- TransferConfig transferConfig,
DynamicMap<ProjectConfigEntry> pluginConfigEntries,
PluginConfigFactory cfgFactory,
AllProjectsName allProjects,
@@ -98,7 +97,7 @@
this.requireSignedPush = requireSignedPush;
}
- this.maxObjectSizeLimit = getMaxObjectSizeLimit(projectState, transferConfig, p);
+ this.maxObjectSizeLimit = getMaxObjectSizeLimit(projectState, p);
this.submitType = p.getSubmitType();
this.state =
@@ -122,13 +121,13 @@
this.theme = projectState.getTheme();
}
- private MaxObjectSizeLimitInfo getMaxObjectSizeLimit(
- ProjectState projectState, TransferConfig transferConfig, Project p) {
+ private MaxObjectSizeLimitInfo getMaxObjectSizeLimit(ProjectState projectState, Project p) {
MaxObjectSizeLimitInfo info = new MaxObjectSizeLimitInfo();
- long value = projectState.getEffectiveMaxObjectSizeLimit();
+ EffectiveMaxObjectSizeLimit limit = projectState.getEffectiveMaxObjectSizeLimit();
+ long value = limit.value;
info.value = value == 0 ? null : String.valueOf(value);
info.configuredValue = p.getMaxObjectSizeLimit();
- info.inheritedValue = transferConfig.getFormattedMaxObjectSizeLimit();
+ info.summary = limit.summary;
return info;
}
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java
index 08df386..1bf001b 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/GetConfig.java
@@ -22,14 +22,12 @@
import com.google.gerrit.server.config.AllProjectsName;
import com.google.gerrit.server.config.PluginConfigFactory;
import com.google.gerrit.server.config.ProjectConfigEntry;
-import com.google.gerrit.server.git.TransferConfig;
import com.google.inject.Inject;
import com.google.inject.Singleton;
@Singleton
public class GetConfig implements RestReadView<ProjectResource> {
private final boolean serverEnableSignedPush;
- private final TransferConfig transferConfig;
private final DynamicMap<ProjectConfigEntry> pluginConfigEntries;
private final PluginConfigFactory cfgFactory;
private final AllProjectsName allProjects;
@@ -38,13 +36,11 @@
@Inject
public GetConfig(
@EnableSignedPush boolean serverEnableSignedPush,
- TransferConfig transferConfig,
DynamicMap<ProjectConfigEntry> pluginConfigEntries,
PluginConfigFactory cfgFactory,
AllProjectsName allProjects,
DynamicMap<RestView<ProjectResource>> views) {
this.serverEnableSignedPush = serverEnableSignedPush;
- this.transferConfig = transferConfig;
this.pluginConfigEntries = pluginConfigEntries;
this.allProjects = allProjects;
this.cfgFactory = cfgFactory;
@@ -56,7 +52,6 @@
return new ConfigInfoImpl(
serverEnableSignedPush,
resource.getControl(),
- transferConfig,
pluginConfigEntries,
cfgFactory,
allProjects,
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java
index 9e9526d..2e3677d 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/ProjectState.java
@@ -17,6 +17,7 @@
import static com.google.gerrit.common.data.PermissionRule.Action.ALLOW;
import static java.nio.charset.StandardCharsets.UTF_8;
+import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.FluentIterable;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.Iterables;
@@ -245,13 +246,55 @@
return cfg;
}
- public long getEffectiveMaxObjectSizeLimit() {
- long local = config.getMaxObjectSizeLimit();
- if (globalMaxObjectSizeLimit > 0 && local > 0) {
- return Math.min(globalMaxObjectSizeLimit, local);
+ public static class EffectiveMaxObjectSizeLimit {
+ public long value;
+ public String summary;
+ }
+
+ private static final String MAY_NOT_SET = "This project may not set a higher limit.";
+
+ @VisibleForTesting
+ public static final String INHERITED_FROM_PARENT = "Inherited from parent project '%s'.";
+
+ @VisibleForTesting
+ public static final String OVERRIDDEN_BY_PARENT =
+ "Overridden by parent project '%s'. " + MAY_NOT_SET;
+
+ @VisibleForTesting
+ public static final String INHERITED_FROM_GLOBAL = "Inherited from the global config.";
+
+ @VisibleForTesting
+ public static final String OVERRIDDEN_BY_GLOBAL =
+ "Overridden by the global config. " + MAY_NOT_SET;
+
+ public EffectiveMaxObjectSizeLimit getEffectiveMaxObjectSizeLimit() {
+ EffectiveMaxObjectSizeLimit result = new EffectiveMaxObjectSizeLimit();
+
+ result.value = config.getMaxObjectSizeLimit();
+ for (ProjectState parent : parents()) {
+ long parentValue = parent.config.getMaxObjectSizeLimit();
+ if (parentValue > 0 && result.value > 0) {
+ if (parentValue < result.value) {
+ result.value = parentValue;
+ result.summary = String.format(OVERRIDDEN_BY_PARENT, parent.config.getName());
+ }
+ } else if (parentValue > 0) {
+ result.value = parentValue;
+ result.summary = String.format(INHERITED_FROM_PARENT, parent.config.getName());
+ }
}
- // zero means "no limit", in this case the max is more limiting
- return Math.max(globalMaxObjectSizeLimit, local);
+
+ if (globalMaxObjectSizeLimit > 0 && result.value > 0) {
+ if (globalMaxObjectSizeLimit < result.value) {
+ result.value = globalMaxObjectSizeLimit;
+ result.summary = OVERRIDDEN_BY_GLOBAL;
+ }
+ } else if (globalMaxObjectSizeLimit > result.value) {
+ // zero means "no limit", in this case the max is more limiting
+ result.value = globalMaxObjectSizeLimit;
+ result.summary = INHERITED_FROM_GLOBAL;
+ }
+ return result;
}
/** Get the sections that pertain only to this project. */
diff --git a/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java b/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
index 4ec8a77..85dcfbc 100644
--- a/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
+++ b/gerrit-server/src/main/java/com/google/gerrit/server/project/PutConfig.java
@@ -36,7 +36,6 @@
import com.google.gerrit.server.config.ProjectConfigEntry;
import com.google.gerrit.server.git.MetaDataUpdate;
import com.google.gerrit.server.git.ProjectConfig;
-import com.google.gerrit.server.git.TransferConfig;
import com.google.inject.Inject;
import com.google.inject.Provider;
import com.google.inject.Singleton;
@@ -58,7 +57,6 @@
private final Provider<MetaDataUpdate.User> metaDataUpdateFactory;
private final ProjectCache projectCache;
private final ProjectState.Factory projectStateFactory;
- private final TransferConfig transferConfig;
private final DynamicMap<ProjectConfigEntry> pluginConfigEntries;
private final PluginConfigFactory cfgFactory;
private final AllProjectsName allProjects;
@@ -71,7 +69,6 @@
Provider<MetaDataUpdate.User> metaDataUpdateFactory,
ProjectCache projectCache,
ProjectState.Factory projectStateFactory,
- TransferConfig transferConfig,
DynamicMap<ProjectConfigEntry> pluginConfigEntries,
PluginConfigFactory cfgFactory,
AllProjectsName allProjects,
@@ -81,7 +78,6 @@
this.metaDataUpdateFactory = metaDataUpdateFactory;
this.projectCache = projectCache;
this.projectStateFactory = projectStateFactory;
- this.transferConfig = transferConfig;
this.pluginConfigEntries = pluginConfigEntries;
this.cfgFactory = cfgFactory;
this.allProjects = allProjects;
@@ -176,7 +172,6 @@
return new ConfigInfoImpl(
serverEnableSignedPush,
state.controlFor(user.get()),
- transferConfig,
pluginConfigEntries,
cfgFactory,
allProjects,