Skip to content

Commit 8b18402

Browse files
Merge remote-tracking branch 'upstream/main' into pnpm
2 parents e3e68ee + a2d88cd commit 8b18402

File tree

34 files changed

+371
-159
lines changed

34 files changed

+371
-159
lines changed

.devcontainer/devcontainer.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
{
22
"name": "Gitea DevContainer",
33
"image": "mcr.microsoft.com/devcontainers/go:1.24-bookworm",
4+
"containerEnv": {
5+
// override "local" from packaged version
6+
"GOTOOLCHAIN": "auto"
7+
},
48
"features": {
59
// installs nodejs into container
610
"ghcr.io/devcontainers/features/node:1": {

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ XGO_VERSION := go-1.25.x
2828
AIR_PACKAGE ?= github.com/air-verse/air@v1
2929
EDITORCONFIG_CHECKER_PACKAGE ?= github.com/editorconfig-checker/editorconfig-checker/v3/cmd/editorconfig-checker@v3
3030
GOFUMPT_PACKAGE ?= mvdan.cc/gofumpt@v0.8.0
31-
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.1.6
31+
GOLANGCI_LINT_PACKAGE ?= github.com/golangci/golangci-lint/v2/cmd/golangci-lint@v2.4.0
3232
GXZ_PACKAGE ?= github.com/ulikunitz/xz/cmd/gxz@v0.5.12
3333
MISSPELL_PACKAGE ?= github.com/golangci/misspell/cmd/misspell@v0.7.0
3434
SWAGGER_PACKAGE ?= github.com/go-swagger/go-swagger/cmd/swagger@v0.32.3

contrib/upgrade.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ fi
8585
# confirm update
8686
echo "Checking currently installed version..."
8787
current=$(giteacmd --version | cut -d ' ' -f 3)
88-
[[ "$current" == "$giteaversion" ]] && echo "$current is already installed, stopping." && exit 1
88+
[[ "$current" == "$giteaversion" ]] && echo "$current is already installed, stopping." && exit 0
8989
if [[ -z "${no_confirm:-}" ]]; then
9090
echo "Make sure to read the changelog first: https://github.com/go-gitea/gitea/blob/main/CHANGELOG.md"
9191
echo "Are you ready to update Gitea from ${current} to ${giteaversion}? (y/N)"

flake.nix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
gnused
4141
gnutar
4242
gzip
43+
zip
4344

4445
# frontend
4546
nodejs

models/issues/pull.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ import (
2929

3030
var ErrMustCollaborator = util.NewPermissionDeniedErrorf("user must be a collaborator")
3131

32+
const reviewedBy = "Reviewed-by: "
33+
3234
// ErrPullRequestNotExist represents a "PullRequestNotExist" kind of error.
3335
type ErrPullRequestNotExist struct {
3436
ID int64
@@ -348,7 +350,11 @@ type ReviewCount struct {
348350
func (pr *PullRequest) GetApprovalCounts(ctx context.Context) ([]*ReviewCount, error) {
349351
rCounts := make([]*ReviewCount, 0, 6)
350352
sess := db.GetEngine(ctx).Where("issue_id = ?", pr.IssueID)
351-
return rCounts, sess.Select("issue_id, type, count(id) as `count`").Where("official = ? AND dismissed = ?", true, false).GroupBy("issue_id, type").Table("review").Find(&rCounts)
353+
return rCounts, sess.Select("issue_id, type, count(id) as `count`").
354+
Where(builder.Eq{"official": true, "dismissed": false}).
355+
GroupBy("issue_id, type").
356+
Table("review").
357+
Find(&rCounts)
352358
}
353359

354360
// GetApprovers returns the approvers of the pull request
@@ -392,7 +398,7 @@ func (pr *PullRequest) getReviewedByLines(ctx context.Context, writer io.Writer)
392398
} else if review.Reviewer == nil {
393399
continue
394400
}
395-
if _, err := writer.Write([]byte("Reviewed-by: ")); err != nil {
401+
if _, err := writer.Write([]byte(reviewedBy)); err != nil {
396402
return err
397403
}
398404
if _, err := writer.Write([]byte(review.Reviewer.NewGitSig().String())); err != nil {

models/repo/collaboration_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,8 @@ func TestRepository_ChangeCollaborationAccessMode(t *testing.T) {
8585

8686
assert.NoError(t, repo_model.ChangeCollaborationAccessMode(db.DefaultContext, repo, unittest.NonexistentID, perm.AccessModeAdmin))
8787

88-
// Disvard invalid input.
89-
assert.NoError(t, repo_model.ChangeCollaborationAccessMode(db.DefaultContext, repo, 4, perm.AccessMode(unittest.NonexistentID)))
88+
// Discard invalid input.
89+
assert.NoError(t, repo_model.ChangeCollaborationAccessMode(db.DefaultContext, repo, 4, perm.AccessMode(-1)))
9090

9191
unittest.CheckConsistencyFor(t, &repo_model.Repository{ID: repo.ID})
9292
}

models/user/user.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -955,6 +955,16 @@ func UpdateUserCols(ctx context.Context, u *User, cols ...string) error {
955955
return err
956956
}
957957

958+
// UpdateUserColsNoAutoTime update user according special columns
959+
func UpdateUserColsNoAutoTime(ctx context.Context, u *User, cols ...string) error {
960+
if err := ValidateUser(u, cols...); err != nil {
961+
return err
962+
}
963+
964+
_, err := db.GetEngine(ctx).ID(u.ID).Cols(cols...).NoAutoTime().Update(u)
965+
return err
966+
}
967+
958968
// GetInactiveUsers gets all inactive users
959969
func GetInactiveUsers(ctx context.Context, olderThan time.Duration) ([]*User, error) {
960970
cond := builder.And(

modules/gtprof/trace_builtin.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ func (t *traceBuiltinSpan) toString(out *strings.Builder, indent int) {
4040
if t.ts.endTime.IsZero() {
4141
out.WriteString(" duration: (not ended)")
4242
} else {
43-
fmt.Fprintf(out, " duration=%.4fs", t.ts.endTime.Sub(t.ts.startTime).Seconds())
43+
fmt.Fprintf(out, " start=%s duration=%.4fs", t.ts.startTime.Format("2006-01-02 15:04:05"), t.ts.endTime.Sub(t.ts.startTime).Seconds())
4444
}
4545
for _, a := range t.ts.attributes {
4646
out.WriteString(" ")

modules/indexer/issues/util.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
9797
return nil, false, err
9898
}
9999

100+
if err := issue.Repo.LoadOwner(ctx); err != nil {
101+
return nil, false, fmt.Errorf("issue.Repo.LoadOwner: %w", err)
102+
}
103+
100104
return &internal.IndexerData{
101105
ID: issue.ID,
102106
RepoID: issue.RepoID,
103-
IsPublic: !issue.Repo.IsPrivate,
107+
IsPublic: !issue.Repo.IsPrivate && issue.Repo.Owner.Visibility.IsPublic(),
104108
Title: issue.Title,
105109
Content: issue.Content,
106110
Comments: comments,

modules/setting/config.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ func DefaultOpenWithEditorApps() OpenWithEditorAppsType {
4949

5050
type RepositoryStruct struct {
5151
OpenWithEditorApps *config.Value[OpenWithEditorAppsType]
52+
GitGuideRemoteName *config.Value[string]
5253
}
5354

5455
type ConfigStruct struct {
@@ -70,6 +71,7 @@ func initDefaultConfig() {
7071
},
7172
Repository: &RepositoryStruct{
7273
OpenWithEditorApps: config.ValueJSON[OpenWithEditorAppsType]("repository.open-with.editor-apps"),
74+
GitGuideRemoteName: config.ValueJSON[string]("repository.git-guide-remote-name").WithDefault("origin"),
7375
},
7476
}
7577
}

0 commit comments

Comments
 (0)