Merge branch 'stable-3.4' into stable-3.5
* stable-3.4:
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
Zuul gerrit-base project: Downgrade java_version to 8
Change I1b9826ec1 "Zuul gerrit-base project: Downgrade java_version to 8"
is reverted during the merge, because starting from stable-3.5 branch
Java 8 support is discontinued.
Release-Notes: skip
Change-Id: Ic242163393280c2e2a4908454876f8d0abd4a0dd
diff --git a/Documentation/user-search.txt b/Documentation/user-search.txt
index cc8d813..f07a504 100644
--- a/Documentation/user-search.txt
+++ b/Documentation/user-search.txt
@@ -531,7 +531,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/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();
+ }
+}