Skip to content

Commit 3ddb542

Browse files
committed
Merge remote-tracking branch 'giteaofficial/main'
* giteaofficial/main: [skip ci] Updated translations via Crowdin Increase gap on latest commit (go-gitea#35104) Fix job status aggregation logic (go-gitea#35000) Fix some missed GitHeadRefName when renaming (go-gitea#35102) Fix error logs and improve some comments/messages (go-gitea#35105) Support Basic Authentication for archive downloads (go-gitea#35087) Run `uv run` with `--frozen` (go-gitea#35097) Improve package API log handling (go-gitea#35100) Rename pull request GetGitRefName to GetGitHeadRefName (go-gitea#35093) Fix review comment/dimiss comment x reference can be refereced back (go-gitea#35094) Fix submodule nil check (go-gitea#35096) Redirect to a presigned URL of HEAD for HEAD requests (go-gitea#35088)
2 parents e67766c + 3e8aa52 commit 3ddb542

Some content is hidden

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

87 files changed

+376
-340
lines changed

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -393,11 +393,11 @@ lint-actions: ## lint action workflow files
393393
.PHONY: lint-templates
394394
lint-templates: .venv node_modules ## lint template files
395395
@node tools/lint-templates-svg.js
396-
@uv run djlint $(shell find templates -type f -iname '*.tmpl')
396+
@uv run --frozen djlint $(shell find templates -type f -iname '*.tmpl')
397397

398398
.PHONY: lint-yaml
399399
lint-yaml: .venv ## lint yaml files
400-
@uv run yamllint -s .
400+
@uv run --frozen yamllint -s .
401401

402402
.PHONY: watch
403403
watch: ## watch everything and continuously rebuild

models/actions/run_job.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ func AggregateJobStatus(jobs []*ActionRunJob) Status {
187187
return StatusCancelled
188188
case hasRunning:
189189
return StatusRunning
190-
case hasFailure:
191-
return StatusFailure
192190
case hasWaiting:
193191
return StatusWaiting
192+
case hasFailure:
193+
return StatusFailure
194194
case hasBlocked:
195195
return StatusBlocked
196196
default:

models/actions/run_job_status_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func TestAggregateJobStatus(t *testing.T) {
6464
{[]Status{StatusFailure, StatusSuccess}, StatusFailure},
6565
{[]Status{StatusFailure, StatusSkipped}, StatusFailure},
6666
{[]Status{StatusFailure, StatusCancelled}, StatusCancelled},
67-
{[]Status{StatusFailure, StatusWaiting}, StatusFailure},
67+
{[]Status{StatusFailure, StatusWaiting}, StatusWaiting},
6868
{[]Status{StatusFailure, StatusRunning}, StatusRunning},
6969
{[]Status{StatusFailure, StatusBlocked}, StatusFailure},
7070

models/issues/issue_xref.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ func (issue *Issue) verifyReferencedIssue(stdCtx context.Context, ctx *crossRefe
235235

236236
// AddCrossReferences add cross references
237237
func (c *Comment) AddCrossReferences(stdCtx context.Context, doer *user_model.User, removeOld bool) error {
238-
if c.Type != CommentTypeCode && c.Type != CommentTypeComment {
238+
if !c.Type.HasContentSupport() {
239239
return nil
240240
}
241241
if err := c.LoadIssue(stdCtx); err != nil {

models/issues/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,8 @@ func (pr *PullRequest) getReviewedByLines(ctx context.Context, writer io.Writer)
413413
return committer.Commit()
414414
}
415415

416-
// GetGitRefName returns git ref for hidden pull request branch
417-
func (pr *PullRequest) GetGitRefName() string {
416+
// GetGitHeadRefName returns git ref for hidden pull request branch
417+
func (pr *PullRequest) GetGitHeadRefName() string {
418418
return fmt.Sprintf("%s%d/head", git.PullPrefix, pr.Index)
419419
}
420420

modules/actions/artifacts.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func IsArtifactV4(art *actions_model.ActionArtifact) bool {
2020

2121
func DownloadArtifactV4ServeDirectOnly(ctx *context.Base, art *actions_model.ActionArtifact) (bool, error) {
2222
if setting.Actions.ArtifactStorage.ServeDirect() {
23-
u, err := storage.ActionsArtifacts.URL(art.StoragePath, art.ArtifactPath, nil)
23+
u, err := storage.ActionsArtifacts.URL(art.StoragePath, art.ArtifactPath, ctx.Req.Method, nil)
2424
if u != nil && err == nil {
2525
ctx.Redirect(u.String(), http.StatusFound)
2626
return true, nil

modules/git/commit_info.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type CommitInfo struct {
1515
func getCommitInfoSubmoduleFile(repoLink string, entry *TreeEntry, commit *Commit, treePathDir string) (*CommitSubmoduleFile, error) {
1616
fullPath := path.Join(treePathDir, entry.Name())
1717
submodule, err := commit.GetSubModule(fullPath)
18-
if err != nil {
18+
if submodule == nil || err != nil {
1919
return nil, err
2020
}
2121
return NewCommitSubmoduleFile(repoLink, fullPath, submodule.URL, entry.ID.String()), nil

modules/git/commit_info_test.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"time"
1010

1111
"github.com/stretchr/testify/assert"
12+
"github.com/stretchr/testify/require"
1213
)
1314

1415
const (
@@ -120,6 +121,16 @@ func TestEntries_GetCommitsInfo(t *testing.T) {
120121
defer clonedRepo1.Close()
121122

122123
testGetCommitsInfo(t, clonedRepo1)
124+
125+
t.Run("NonExistingSubmoduleAsNil", func(t *testing.T) {
126+
commit, err := bareRepo1.GetCommit("HEAD")
127+
require.NoError(t, err)
128+
tree, err := commit.GetTreeEntryByPath("file1.txt")
129+
require.NoError(t, err)
130+
cisf, err := getCommitInfoSubmoduleFile("/any/repo-link", tree, commit, "")
131+
require.NoError(t, err)
132+
assert.Nil(t, cisf)
133+
})
123134
}
124135

125136
func BenchmarkEntries_GetCommitsInfo(b *testing.B) {

modules/git/commit_submodule.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ func (c *Commit) GetSubModules() (*ObjectCache[*SubModule], error) {
3535
return c.submoduleCache, nil
3636
}
3737

38-
// GetSubModule get the submodule according entry name
38+
// GetSubModule gets the submodule by the entry name.
39+
// It returns "nil, nil" if the submodule does not exist, caller should always remember to check the "nil"
3940
func (c *Commit) GetSubModule(entryName string) (*SubModule, error) {
4041
modules, err := c.GetSubModules()
4142
if err != nil {

modules/migration/pullrequest.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ func (p *PullRequest) IsForkPullRequest() bool {
4949
return p.Head.RepoFullName() != p.Base.RepoFullName()
5050
}
5151

52-
// GetGitRefName returns pull request relative path to head
53-
func (p PullRequest) GetGitRefName() string {
52+
// GetGitHeadRefName returns pull request relative path to head
53+
func (p PullRequest) GetGitHeadRefName() string {
5454
return fmt.Sprintf("%s%d/head", git.PullPrefix, p.Number)
5555
}
5656

0 commit comments

Comments
 (0)