Skip to content

Commit a965cd5

Browse files
Merge branch 'main' into ssh-mirroring
2 parents 795bd80 + 37958e4 commit a965cd5

File tree

88 files changed

+546
-198
lines changed

Some content is hidden

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

88 files changed

+546
-198
lines changed

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ func (pr *PullRequest) getReviewedByLines(ctx context.Context, writer io.Writer)
414414
}
415415

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,9 @@ const (
2121
SignupUserAgent = "signup.user_agent"
2222

2323
SettingsKeyCodeViewShowFileTree = "code_view.show_file_tree"
24+
25+
SettingsKeyEmailNotificationGiteaActions = "email_notification.gitea_actions"
26+
SettingEmailNotificationGiteaActionsAll = "all"
27+
SettingEmailNotificationGiteaActionsFailureOnly = "failure-only" // Default for actions email preference
28+
SettingEmailNotificationGiteaActionsDisabled = "disabled"
2429
)

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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ func (p *PullRequest) IsForkPullRequest() bool {
5050
}
5151

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

modules/packages/content_store.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ func (s *ContentStore) ShouldServeDirect() bool {
3636
return setting.Packages.Storage.ServeDirect()
3737
}
3838

39-
func (s *ContentStore) GetServeDirectURL(key BlobHash256Key, filename string, reqParams url.Values) (*url.URL, error) {
40-
return s.store.URL(KeyToRelativePath(key), filename, reqParams)
39+
func (s *ContentStore) GetServeDirectURL(key BlobHash256Key, filename, method string, reqParams url.Values) (*url.URL, error) {
40+
return s.store.URL(KeyToRelativePath(key), filename, method, reqParams)
4141
}
4242

4343
// FIXME: Workaround to be removed in v1.20

modules/storage/azureblob.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ func (a *AzureBlobStorage) Delete(path string) error {
247247
}
248248

249249
// URL gets the redirect URL to a file. The presigned link is valid for 5 minutes.
250-
func (a *AzureBlobStorage) URL(path, name string, reqParams url.Values) (*url.URL, error) {
250+
func (a *AzureBlobStorage) URL(path, name, _ string, reqParams url.Values) (*url.URL, error) {
251251
blobClient := a.getBlobClient(path)
252252

253253
startTime := time.Now()

0 commit comments

Comments
 (0)