Merge branch 'stable-3.5' into stable-3.6
* stable-3.5:
Detect DelegateRepository in GarbageCollection operation
Allow reuse of DelegateRepository functionality
Fix gerrit review command with branch option
Fix link to change.mergeabilityComputationBehavior in user-search.txt
Propagate auto flush value to external index module
Zuul gerrit-base project: Downgrade java_version to 8
Release-Notes: skip
Change-Id: If78e7d9544fb963d603fce88b4cbbc0abef981a7
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index bae083b..8c1e5c8 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -555,7 +555,7 @@
not find any abandoned but mergeable changes.
+
This operator only works if Gerrit indexes 'mergeable'. See
-link:config-gerrit.html#index.change.indexMergeable[indexMergeable]
+link:config-gerrit.html#change.mergeabilityComputationBehavior[change.mergeabilityComputationBehavior]
for details.
[[ignored]]
diff --git a/java/com/google/gerrit/server/LibModuleLoader.java b/java/com/google/gerrit/server/LibModuleLoader.java
index cf53c80..5c0f8e4 100644
--- a/java/com/google/gerrit/server/LibModuleLoader.java
+++ b/java/com/google/gerrit/server/LibModuleLoader.java
@@ -18,6 +18,7 @@
import com.google.common.flogger.FluentLogger;
import com.google.gerrit.server.config.GerritServerConfig;
+import com.google.gerrit.server.index.options.AutoFlush;
import com.google.inject.Injector;
import com.google.inject.Key;
import com.google.inject.Module;
@@ -55,9 +56,14 @@
try {
Method m =
- clazz.getMethod("singleVersionWithExplicitVersions", Map.class, int.class, boolean.class);
+ clazz.getMethod(
+ "singleVersionWithExplicitVersions",
+ Map.class,
+ int.class,
+ boolean.class,
+ AutoFlush.class);
- Module module = (Module) m.invoke(null, versions, threads, replica);
+ Module module = (Module) m.invoke(null, versions, threads, replica, AutoFlush.DISABLED);
logger.atInfo().log("Installed module %s", className);
return module;
} catch (Exception e) {
diff --git a/java/com/google/gerrit/sshd/commands/PatchSetParser.java b/java/com/google/gerrit/sshd/commands/PatchSetParser.java
index 4ebf15e..65d48dd 100644
--- a/java/com/google/gerrit/sshd/commands/PatchSetParser.java
+++ b/java/com/google/gerrit/sshd/commands/PatchSetParser.java
@@ -18,6 +18,7 @@
import com.google.gerrit.entities.Change;
import com.google.gerrit.entities.PatchSet;
import com.google.gerrit.entities.Project;
+import com.google.gerrit.entities.RefNames;
import com.google.gerrit.git.ObjectIds;
import com.google.gerrit.server.PatchSetUtil;
import com.google.gerrit.server.change.ChangeFinder;
@@ -59,6 +60,7 @@
if (token.matches("^([0-9a-fA-F]{4," + ObjectIds.STR_LEN + "})$")) {
InternalChangeQuery query = queryProvider.get();
List<ChangeData> cds;
+ branch = branch != null ? RefNames.fullName(branch) : null;
if (projectState != null) {
Project.NameKey p = projectState.getNameKey();
if (branch != null) {
diff --git a/javatests/com/google/gerrit/acceptance/api/change/ChangeReviewIT.java b/javatests/com/google/gerrit/acceptance/api/change/ChangeReviewIT.java
new file mode 100644
index 0000000..2b04e56
--- /dev/null
+++ b/javatests/com/google/gerrit/acceptance/api/change/ChangeReviewIT.java
@@ -0,0 +1,49 @@
+// Copyright (C) 2022 The Android Open Source Project
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+package com.google.gerrit.acceptance.api.change;
+
+import com.google.gerrit.acceptance.AbstractDaemonTest;
+import com.google.gerrit.acceptance.PushOneCommit;
+import com.google.gerrit.acceptance.UseSsh;
+import org.junit.Test;
+
+@UseSsh
+public class ChangeReviewIT extends AbstractDaemonTest {
+
+ @Test
+ public void testGerritReviewCommandWithShortNameBranch() throws Exception {
+ PushOneCommit.Result r = createChange();
+ adminSshSession.exec(
+ "gerrit review --project "
+ + r.getChange().change().getProject().get()
+ + " --branch "
+ + r.getChange().change().getDest().shortName()
+ + " --code-review 1 "
+ + r.getCommit().getName());
+ adminSshSession.assertSuccess();
+ }
+
+ @Test
+ public void testGerritReviewCommandWithoutProject() throws Exception {
+ PushOneCommit.Result r = createChange();
+ adminSshSession.exec(
+ "gerrit review"
+ + " --branch "
+ + r.getChange().change().getDest().shortName()
+ + " --code-review 1 "
+ + r.getCommit().getName());
+ adminSshSession.assertSuccess();
+ }
+}