Skip to content

Commit f1fc794

Browse files
authored
Fix warnings in JGitUtil (#3683)
1 parent 4cf924b commit f1fc794

File tree

5 files changed

+104
-126
lines changed

5 files changed

+104
-126
lines changed

src/main/scala/gitbucket/core/controller/api/ApiRepositoryBranchControllerBase.scala

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,7 @@ trait ApiRepositoryBranchControllerBase extends ControllerBase {
2323
Using.resource(Git.open(getRepositoryDir(repository.owner, repository.name))) { git =>
2424
JsonFormat(
2525
JGitUtil
26-
.getBranchesNoMergeInfo(
27-
git = git,
28-
defaultBranch = repository.repository.defaultBranch
29-
)
26+
.getBranchesNoMergeInfo(git)
3027
.map { br =>
3128
ApiBranchForList(br.name, ApiBranchCommit(br.commitId))
3229
}
@@ -42,10 +39,7 @@ trait ApiRepositoryBranchControllerBase extends ControllerBase {
4239
Using.resource(Git.open(getRepositoryDir(repository.owner, repository.name))) { git =>
4340
(for {
4441
branch <- params.get("splat") if repository.branchList.contains(branch)
45-
br <- getBranchesNoMergeInfo(
46-
git,
47-
repository.repository.defaultBranch
48-
).find(_.name == branch)
42+
br <- getBranchesNoMergeInfo(git).find(_.name == branch)
4943
} yield {
5044
val protection = getProtectedBranchInfo(repository.owner, repository.name, branch)
5145
JsonFormat(
@@ -269,10 +263,7 @@ trait ApiRepositoryBranchControllerBase extends ControllerBase {
269263
(for {
270264
branch <- params.get("splat") if repository.branchList.contains(branch)
271265
protection <- extractFromJsonBody[ApiBranchProtection.EnablingAndDisabling].map(_.protection)
272-
br <- getBranchesNoMergeInfo(
273-
git,
274-
repository.repository.defaultBranch
275-
).find(_.name == branch)
266+
br <- getBranchesNoMergeInfo(git).find(_.name == branch)
276267
} yield {
277268
if (protection.enabled) {
278269
enableBranchProtection(

src/main/scala/gitbucket/core/controller/api/ApiRepositoryCommitControllerBase.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ trait ApiRepositoryCommitControllerBase extends ControllerBase {
159159
Using.resource(Git.open(getRepositoryDir(repository.owner, repository.name))) { git =>
160160
val apiBranchForCommits = for {
161161
branch <- getBranchesOfCommit(git, sha)
162-
br <- getBranchesNoMergeInfo(git, branch).find(_.name == branch)
162+
br <- getBranchesNoMergeInfo(git).find(_.name == branch)
163163
} yield {
164164
val protection = getProtectedBranchInfo(repository.owner, repository.name, branch)
165165
ApiBranchForHeadCommit(branch, ApiBranchCommit(br.commitId), protection.enabled)

src/main/scala/gitbucket/core/service/PullRequestService.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ trait PullRequestService {
313313
base.foreach { _base =>
314314
if (pr.branch != _base) {
315315
Using.resource(Git.open(getRepositoryDir(repository.owner, repository.name))) { git =>
316-
getBranchesNoMergeInfo(git, repository.repository.defaultBranch)
316+
getBranchesNoMergeInfo(git)
317317
.find(_.name == _base)
318318
.foreach(br => updateBaseBranch(repository.owner, repository.name, issueId, br.name, br.commitId))
319319
}

0 commit comments

Comments
 (0)