Skip to content

Commit 42944e7

Browse files
committed
Merge tag '3.11.1' into develop
release version 3.11.1
2 parents bf63ad2 + 4358697 commit 42944e7

File tree

5 files changed

+20
-6
lines changed

5 files changed

+20
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## 3.11.1 - 2025-09-04
8+
### Fixed
9+
- Failing post-commit hook on SVN repository, because it does not support the BranchResolver
10+
711
## 3.11.0 - 2025-08-20
812
### Added
913
- Support for the new merge strategy fast forward only

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,4 @@
1414
# along with this program. If not, see https://www.gnu.org/licenses/.
1515
#
1616

17-
version = 3.11.1-SNAPSHOT
17+
version = 3.11.1

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@scm-manager/scm-review-plugin",
33
"private": false,
4-
"version": "3.11.1-SNAPSHOT",
4+
"version": "3.11.1",
55
"license": "AGPL-3.0-only",
66
"main": "./src/main/js/index.tsx",
77
"scripts": {

src/main/java/com/cloudogu/scm/review/pullrequest/service/PullRequestSuggestionService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,14 @@ public void onBranchUpdated(PostReceiveRepositoryHookEvent event) {
7070
Repository repository = event.getRepository();
7171

7272
boolean isNotSupported = !pullRequestService.supportsPullRequests(repository);
73-
boolean isSingleOrNoBranch = branchResolver.getAll(repository).size() < 2;
73+
if (isNotSupported) {
74+
return;
75+
}
7476

75-
if (isNotSupported || isSingleOrNoBranch) {
77+
// check the branches only if PullRequests support (abort before branch check)
78+
// because BranchResolver throws an error to the client if the repository type does not support branches
79+
boolean isSingleOrNoBranch = branchResolver.getAll(repository).size() < 2;
80+
if (isSingleOrNoBranch) {
7681
return;
7782
}
7883

src/test/java/com/cloudogu/scm/review/pullrequest/service/PullRequestSuggestionServiceTest.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import org.mockito.junit.jupiter.MockitoExtension;
3232
import sonia.scm.HandlerEventType;
3333
import sonia.scm.repository.Branch;
34+
import sonia.scm.repository.InternalRepositoryException;
3435
import sonia.scm.repository.Person;
3536
import sonia.scm.repository.PostReceiveRepositoryHookEvent;
3637
import sonia.scm.repository.Repository;
@@ -47,6 +48,7 @@
4748
import java.util.List;
4849

4950
import static org.assertj.core.api.Assertions.assertThat;
51+
import static org.mockito.Mockito.lenient;
5052
import static org.mockito.Mockito.when;
5153

5254
@ExtendWith({MockitoExtension.class, ShiroExtension.class})
@@ -78,10 +80,10 @@ class OnBranchPushed {
7880
@BeforeEach
7981
void setup() {
8082
when(pullRequestService.supportsPullRequests(repository)).thenReturn(true);
81-
when(hookContext.getBranchProvider().getCreatedOrModified()).thenReturn(
83+
lenient().when(hookContext.getBranchProvider().getCreatedOrModified()).thenReturn(
8284
List.of("feature")
8385
);
84-
when(branchResolver.getAll(repository)).thenReturn(List.of(
86+
lenient().when(branchResolver.getAll(repository)).thenReturn(List.of(
8587
Branch.defaultBranch(
8688
"main",
8789
"revisionOnMain",
@@ -108,7 +110,10 @@ private PostReceiveRepositoryHookEvent createPostReceiveRepositoryHookEvent() {
108110
@Test
109111
void shouldIgnorePushBecauseRepositoryDoesNotSupportPullRequests() {
110112
when(pullRequestService.supportsPullRequests(repository)).thenReturn(false);
113+
lenient().when(branchResolver.getAll(repository)).thenThrow(InternalRepositoryException.class);
114+
111115
suggestionService.onBranchUpdated(createPostReceiveRepositoryHookEvent());
116+
112117
assertThat(suggestionService.getPushEntries()).isEmpty();
113118
}
114119

0 commit comments

Comments
 (0)