Skip to content

Commit fa496e5

Browse files
Merge branch 'main' into feat-version-arch
2 parents 7f98d5f + 1ec8d80 commit fa496e5

Some content is hidden

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

64 files changed

+1263
-593
lines changed

MAINTAINERS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,4 @@ Kemal Zebari <[email protected]> (@kemzeb)
6363
Rowan Bohde <[email protected]> (@bohde)
6464
hiifong <[email protected]> (@hiifong)
6565
metiftikci <[email protected]> (@metiftikci)
66+
Christopher Homberger <[email protected]> (@ChristopherHX)

main_timezones.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2025 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
//go:build windows
5+
6+
package main
7+
8+
// Golang has the ability to load OS's timezone data from most UNIX systems (https://github.com/golang/go/blob/master/src/time/zoneinfo_unix.go)
9+
// Even if the timezone data is missing, users could install the related packages to get it.
10+
// But on Windows, although `zoneinfo_windows.go` tries to load the timezone data from Windows registry,
11+
// some users still suffer from the issue that the timezone data is missing: https://github.com/go-gitea/gitea/issues/33235
12+
// So we import the tzdata package to make sure the timezone data is included in the binary.
13+
//
14+
// For non-Windows package builders, they could still use the "TAGS=timetzdata" to include the tzdata package in the binary.
15+
// If we decided to add the tzdata for other platforms, modify the "go:build" directive above.
16+
import _ "time/tzdata"

models/issues/issue_project.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ func (issue *Issue) projectID(ctx context.Context) int64 {
3838
}
3939

4040
// ProjectColumnID return project column id if issue was assigned to one
41-
func (issue *Issue) ProjectColumnID(ctx context.Context) int64 {
41+
func (issue *Issue) ProjectColumnID(ctx context.Context) (int64, error) {
4242
var ip project_model.ProjectIssue
4343
has, err := db.GetEngine(ctx).Where("issue_id=?", issue.ID).Get(&ip)
44-
if err != nil || !has {
45-
return 0
44+
if err != nil {
45+
return 0, err
46+
} else if !has {
47+
return 0, nil
4648
}
47-
return ip.ProjectColumnID
49+
return ip.ProjectColumnID, nil
4850
}
4951

5052
// LoadIssuesFromColumn load issues assigned to this column

models/project/project.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,10 @@ func GetSearchOrderByBySortType(sortType string) db.SearchOrderBy {
244244
return db.SearchOrderByRecentUpdated
245245
case "leastupdate":
246246
return db.SearchOrderByLeastUpdated
247+
case "alphabetically":
248+
return "title ASC"
249+
case "reversealphabetically":
250+
return "title DESC"
247251
default:
248252
return db.SearchOrderByNewest
249253
}

modules/git/parse.go

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,9 @@ func parseLsTreeLine(line []byte) (*LsTreeEntry, error) {
4646
entry.Size = optional.Some(size)
4747
}
4848

49-
switch string(entryMode) {
50-
case "100644":
51-
entry.EntryMode = EntryModeBlob
52-
case "100755":
53-
entry.EntryMode = EntryModeExec
54-
case "120000":
55-
entry.EntryMode = EntryModeSymlink
56-
case "160000":
57-
entry.EntryMode = EntryModeCommit
58-
case "040000", "040755": // git uses 040000 for tree object, but some users may get 040755 for unknown reasons
59-
entry.EntryMode = EntryModeTree
60-
default:
61-
return nil, fmt.Errorf("unknown type: %v", string(entryMode))
49+
entry.EntryMode, err = ParseEntryMode(string(entryMode))
50+
if err != nil || entry.EntryMode == EntryModeNoEntry {
51+
return nil, fmt.Errorf("invalid ls-tree output (invalid mode): %q, err: %w", line, err)
6252
}
6353

6454
entry.ID, err = NewIDFromString(string(entryObjectID))

modules/git/tree_entry_mode.go

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,20 @@
33

44
package git
55

6-
import "strconv"
6+
import (
7+
"fmt"
8+
"strconv"
9+
)
710

811
// EntryMode the type of the object in the git tree
912
type EntryMode int
1013

1114
// There are only a few file modes in Git. They look like unix file modes, but they can only be
1215
// one of these.
1316
const (
17+
// EntryModeNoEntry is possible if the file was added or removed in a commit. In the case of
18+
// added the base commit will not have the file in its tree so a mode of 0o000000 is used.
19+
EntryModeNoEntry EntryMode = 0o000000
1420
// EntryModeBlob
1521
EntryModeBlob EntryMode = 0o100644
1622
// EntryModeExec
@@ -33,3 +39,22 @@ func ToEntryMode(value string) EntryMode {
3339
v, _ := strconv.ParseInt(value, 8, 32)
3440
return EntryMode(v)
3541
}
42+
43+
func ParseEntryMode(mode string) (EntryMode, error) {
44+
switch mode {
45+
case "000000":
46+
return EntryModeNoEntry, nil
47+
case "100644":
48+
return EntryModeBlob, nil
49+
case "100755":
50+
return EntryModeExec, nil
51+
case "120000":
52+
return EntryModeSymlink, nil
53+
case "160000":
54+
return EntryModeCommit, nil
55+
case "040000", "040755": // git uses 040000 for tree object, but some users may get 040755 for unknown reasons
56+
return EntryModeTree, nil
57+
default:
58+
return 0, fmt.Errorf("unparsable entry mode: %s", mode)
59+
}
60+
}

modules/indexer/issues/util.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
9292
projectID = issue.Project.ID
9393
}
9494

95+
projectColumnID, err := issue.ProjectColumnID(ctx)
96+
if err != nil {
97+
return nil, false, err
98+
}
99+
95100
return &internal.IndexerData{
96101
ID: issue.ID,
97102
RepoID: issue.RepoID,
@@ -106,7 +111,7 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
106111
NoLabel: len(labels) == 0,
107112
MilestoneID: issue.MilestoneID,
108113
ProjectID: projectID,
109-
ProjectColumnID: issue.ProjectColumnID(ctx),
114+
ProjectColumnID: projectColumnID,
110115
PosterID: issue.PosterID,
111116
AssigneeID: issue.AssigneeID,
112117
MentionIDs: mentionIDs,

modules/migration/downloader.go

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,17 @@ import (
1212

1313
// Downloader downloads the site repo information
1414
type Downloader interface {
15-
SetContext(context.Context)
16-
GetRepoInfo() (*Repository, error)
17-
GetTopics() ([]string, error)
18-
GetMilestones() ([]*Milestone, error)
19-
GetReleases() ([]*Release, error)
20-
GetLabels() ([]*Label, error)
21-
GetIssues(page, perPage int) ([]*Issue, bool, error)
22-
GetComments(commentable Commentable) ([]*Comment, bool, error)
23-
GetAllComments(page, perPage int) ([]*Comment, bool, error)
15+
GetRepoInfo(ctx context.Context) (*Repository, error)
16+
GetTopics(ctx context.Context) ([]string, error)
17+
GetMilestones(ctx context.Context) ([]*Milestone, error)
18+
GetReleases(ctx context.Context) ([]*Release, error)
19+
GetLabels(ctx context.Context) ([]*Label, error)
20+
GetIssues(ctx context.Context, page, perPage int) ([]*Issue, bool, error)
21+
GetComments(ctx context.Context, commentable Commentable) ([]*Comment, bool, error)
22+
GetAllComments(ctx context.Context, page, perPage int) ([]*Comment, bool, error)
2423
SupportGetRepoComments() bool
25-
GetPullRequests(page, perPage int) ([]*PullRequest, bool, error)
26-
GetReviews(reviewable Reviewable) ([]*Review, error)
24+
GetPullRequests(ctx context.Context, page, perPage int) ([]*PullRequest, bool, error)
25+
GetReviews(ctx context.Context, reviewable Reviewable) ([]*Review, error)
2726
FormatCloneURL(opts MigrateOptions, remoteAddr string) (string, error)
2827
}
2928

modules/migration/null_downloader.go

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -13,56 +13,53 @@ type NullDownloader struct{}
1313

1414
var _ Downloader = &NullDownloader{}
1515

16-
// SetContext set context
17-
func (n NullDownloader) SetContext(_ context.Context) {}
18-
1916
// GetRepoInfo returns a repository information
20-
func (n NullDownloader) GetRepoInfo() (*Repository, error) {
17+
func (n NullDownloader) GetRepoInfo(_ context.Context) (*Repository, error) {
2118
return nil, ErrNotSupported{Entity: "RepoInfo"}
2219
}
2320

2421
// GetTopics return repository topics
25-
func (n NullDownloader) GetTopics() ([]string, error) {
22+
func (n NullDownloader) GetTopics(_ context.Context) ([]string, error) {
2623
return nil, ErrNotSupported{Entity: "Topics"}
2724
}
2825

2926
// GetMilestones returns milestones
30-
func (n NullDownloader) GetMilestones() ([]*Milestone, error) {
27+
func (n NullDownloader) GetMilestones(_ context.Context) ([]*Milestone, error) {
3128
return nil, ErrNotSupported{Entity: "Milestones"}
3229
}
3330

3431
// GetReleases returns releases
35-
func (n NullDownloader) GetReleases() ([]*Release, error) {
32+
func (n NullDownloader) GetReleases(_ context.Context) ([]*Release, error) {
3633
return nil, ErrNotSupported{Entity: "Releases"}
3734
}
3835

3936
// GetLabels returns labels
40-
func (n NullDownloader) GetLabels() ([]*Label, error) {
37+
func (n NullDownloader) GetLabels(_ context.Context) ([]*Label, error) {
4138
return nil, ErrNotSupported{Entity: "Labels"}
4239
}
4340

4441
// GetIssues returns issues according start and limit
45-
func (n NullDownloader) GetIssues(page, perPage int) ([]*Issue, bool, error) {
42+
func (n NullDownloader) GetIssues(_ context.Context, page, perPage int) ([]*Issue, bool, error) {
4643
return nil, false, ErrNotSupported{Entity: "Issues"}
4744
}
4845

4946
// GetComments returns comments of an issue or PR
50-
func (n NullDownloader) GetComments(commentable Commentable) ([]*Comment, bool, error) {
47+
func (n NullDownloader) GetComments(_ context.Context, commentable Commentable) ([]*Comment, bool, error) {
5148
return nil, false, ErrNotSupported{Entity: "Comments"}
5249
}
5350

5451
// GetAllComments returns paginated comments
55-
func (n NullDownloader) GetAllComments(page, perPage int) ([]*Comment, bool, error) {
52+
func (n NullDownloader) GetAllComments(_ context.Context, page, perPage int) ([]*Comment, bool, error) {
5653
return nil, false, ErrNotSupported{Entity: "AllComments"}
5754
}
5855

5956
// GetPullRequests returns pull requests according page and perPage
60-
func (n NullDownloader) GetPullRequests(page, perPage int) ([]*PullRequest, bool, error) {
57+
func (n NullDownloader) GetPullRequests(_ context.Context, page, perPage int) ([]*PullRequest, bool, error) {
6158
return nil, false, ErrNotSupported{Entity: "PullRequests"}
6259
}
6360

6461
// GetReviews returns pull requests review
65-
func (n NullDownloader) GetReviews(reviewable Reviewable) ([]*Review, error) {
62+
func (n NullDownloader) GetReviews(_ context.Context, reviewable Reviewable) ([]*Review, error) {
6663
return nil, ErrNotSupported{Entity: "Reviews"}
6764
}
6865

0 commit comments

Comments
 (0)