Skip to content

Commit c5aa6db

Browse files
Merge branch 'main' into feat-32257-add-comments-unchanged-lines-and-show
2 parents 38b0d57 + b9913d9 commit c5aa6db

File tree

173 files changed

+1125
-1163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

173 files changed

+1125
-1163
lines changed

.github/workflows/pull-compliance.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ jobs:
9595
go-version-file: go.mod
9696
check-latest: true
9797
- run: make deps-backend deps-tools
98-
- run: make lint-go-windows lint-go-vet
98+
- run: make lint-go-windows lint-go-gitea-vet
9999
env:
100100
TAGS: bindata sqlite sqlite_unlock_notify
101101
GOOS: windows

.github/workflows/pull-db-tests.yml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,12 +202,10 @@ jobs:
202202
test-mssql:
203203
if: needs.files-changed.outputs.backend == 'true' || needs.files-changed.outputs.actions == 'true'
204204
needs: files-changed
205-
# specifying the version of ubuntu in use as mssql fails on newer kernels
206-
# pending resolution from vendor
207-
runs-on: ubuntu-20.04
205+
runs-on: ubuntu-latest
208206
services:
209207
mssql:
210-
image: mcr.microsoft.com/mssql/server:2017-latest
208+
image: mcr.microsoft.com/mssql/server:2019-latest
211209
env:
212210
ACCEPT_EULA: Y
213211
MSSQL_PID: Standard

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ EXTRA_GOFLAGS ?=
7373
MAKE_VERSION := $(shell "$(MAKE)" -v | cat | head -n 1)
7474
MAKE_EVIDENCE_DIR := .make_evidence
7575

76+
GOTESTFLAGS ?= -vet=off
7677
ifeq ($(RACE_ENABLED),true)
7778
GOFLAGS += -race
7879
GOTESTFLAGS += -race
@@ -311,10 +312,10 @@ lint-frontend: lint-js lint-css ## lint frontend files
311312
lint-frontend-fix: lint-js-fix lint-css-fix ## lint frontend files and fix issues
312313

313314
.PHONY: lint-backend
314-
lint-backend: lint-go lint-go-vet lint-go-gopls lint-editorconfig ## lint backend files
315+
lint-backend: lint-go lint-go-gitea-vet lint-go-gopls lint-editorconfig ## lint backend files
315316

316317
.PHONY: lint-backend-fix
317-
lint-backend-fix: lint-go-fix lint-go-vet lint-editorconfig ## lint backend files and fix issues
318+
lint-backend-fix: lint-go-fix lint-go-gitea-vet lint-editorconfig ## lint backend files and fix issues
318319

319320
.PHONY: lint-js
320321
lint-js: node_modules ## lint js files
@@ -365,9 +366,9 @@ lint-go-windows:
365366
@GOOS= GOARCH= $(GO) install $(GOLANGCI_LINT_PACKAGE)
366367
golangci-lint run
367368

368-
.PHONY: lint-go-vet
369-
lint-go-vet: ## lint go files with vet
370-
@echo "Running go vet..."
369+
.PHONY: lint-go-gitea-vet
370+
lint-go-gitea-vet: ## lint go files with gitea-vet
371+
@echo "Running gitea-vet..."
371372
@GOOS= GOARCH= $(GO) build code.gitea.io/gitea-vet
372373
@$(GO) vet -vettool=gitea-vet ./...
373374

cmd/hook.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ func runHookPostReceive(c *cli.Context) error {
316316
setup(ctx, c.Bool("debug"))
317317

318318
// First of all run update-server-info no matter what
319-
if _, _, err := git.NewCommand(ctx, "update-server-info").RunStdString(nil); err != nil {
319+
if _, _, err := git.NewCommand("update-server-info").RunStdString(ctx, nil); err != nil {
320320
return fmt.Errorf("Failed to call 'git update-server-info': %w", err)
321321
}
322322

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ require (
119119
gitlab.com/gitlab-org/api/client-go v0.123.0
120120
golang.org/x/crypto v0.35.0
121121
golang.org/x/image v0.24.0
122-
golang.org/x/net v0.35.0
122+
golang.org/x/net v0.36.0
123123
golang.org/x/oauth2 v0.27.0
124124
golang.org/x/sync v0.11.0
125125
golang.org/x/sys v0.30.0

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -867,8 +867,8 @@ golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
867867
golang.org/x/net v0.21.0/go.mod h1:bIjVDfnllIU7BJ2DNgfnXvpSvtn8VRwhlsaeUTyUS44=
868868
golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM=
869869
golang.org/x/net v0.33.0/go.mod h1:HXLR5J+9DxmrqMwG9qjGCxZ+zKXxBru04zlTvWlWuN4=
870-
golang.org/x/net v0.35.0 h1:T5GQRQb2y08kTAByq9L4/bz8cipCdA8FbRTXewonqY8=
871-
golang.org/x/net v0.35.0/go.mod h1:EglIi67kWsHKlRzzVMUD93VMSWGFOMSZgxFjparz1Qk=
870+
golang.org/x/net v0.36.0 h1:vWF2fRbw4qslQsQzgFqZff+BItCvGFQqKzKIzx1rmoA=
871+
golang.org/x/net v0.36.0/go.mod h1:bFmbeoIPfrw4sMHNhb4J9f6+tPziuGjq7Jk/38fxi1I=
872872
golang.org/x/oauth2 v0.27.0 h1:da9Vo7/tDv5RH/7nZDz1eMGS/q1Vv1N/7FCrBhI9I3M=
873873
golang.org/x/oauth2 v0.27.0/go.mod h1:onh5ek6nERTohokkhCD/y2cV4Do3fxFHFuAejCkRWT8=
874874
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=

models/actions/schedule.go

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,12 @@ func init() {
4343
// GetSchedulesMapByIDs returns the schedules by given id slice.
4444
func GetSchedulesMapByIDs(ctx context.Context, ids []int64) (map[int64]*ActionSchedule, error) {
4545
schedules := make(map[int64]*ActionSchedule, len(ids))
46+
if len(ids) == 0 {
47+
return schedules, nil
48+
}
4649
return schedules, db.GetEngine(ctx).In("id", ids).Find(&schedules)
4750
}
4851

49-
// GetReposMapByIDs returns the repos by given id slice.
50-
func GetReposMapByIDs(ctx context.Context, ids []int64) (map[int64]*repo_model.Repository, error) {
51-
repos := make(map[int64]*repo_model.Repository, len(ids))
52-
return repos, db.GetEngine(ctx).In("id", ids).Find(&repos)
53-
}
54-
5552
// CreateScheduleTask creates new schedule task.
5653
func CreateScheduleTask(ctx context.Context, rows []*ActionSchedule) error {
5754
// Return early if there are no rows to insert

models/actions/schedule_spec_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func (specs SpecList) LoadSchedules(ctx context.Context) error {
3232
}
3333

3434
repoIDs := specs.GetRepoIDs()
35-
repos, err := GetReposMapByIDs(ctx, repoIDs)
35+
repos, err := repo_model.GetRepositoriesMapByIDs(ctx, repoIDs)
3636
if err != nil {
3737
return err
3838
}

models/db/context.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,9 @@ func FindIDs(ctx context.Context, tableName, idCol string, cond builder.Cond) ([
289289
// DecrByIDs decreases the given column for entities of the "bean" type with one of the given ids by one
290290
// Timestamps of the entities won't be updated
291291
func DecrByIDs(ctx context.Context, ids []int64, decrCol string, bean any) error {
292+
if len(ids) == 0 {
293+
return nil
294+
}
292295
_, err := GetEngine(ctx).Decr(decrCol).In("id", ids).NoAutoCondition().NoAutoTime().Update(bean)
293296
return err
294297
}

models/issues/issue.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -595,6 +595,9 @@ func GetIssueByID(ctx context.Context, id int64) (*Issue, error) {
595595
// If keepOrder is true, the order of the returned issues will be the same as the given IDs.
596596
func GetIssuesByIDs(ctx context.Context, issueIDs []int64, keepOrder ...bool) (IssueList, error) {
597597
issues := make([]*Issue, 0, len(issueIDs))
598+
if len(issueIDs) == 0 {
599+
return issues, nil
600+
}
598601

599602
if err := db.GetEngine(ctx).In("id", issueIDs).Find(&issues); err != nil {
600603
return nil, err

0 commit comments

Comments
 (0)