Skip to content

Commit 4dea49e

Browse files
authored
Merge branch 'main' into fix-migration-dns-error
2 parents 4a46f66 + edff571 commit 4dea49e

File tree

9 files changed

+479
-18
lines changed

9 files changed

+479
-18
lines changed

modules/repository/repo.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
9393
return repo, fmt.Errorf("Failed to remove %s: %v", wikiPath, err)
9494
}
9595

96-
if err = git.Clone(ctx, wikiRemotePath, wikiPath, git.CloneRepoOptions{
96+
if err := git.Clone(ctx, wikiRemotePath, wikiPath, git.CloneRepoOptions{
9797
Mirror: true,
9898
Quiet: true,
9999
Timeout: migrateTimeout,
@@ -104,11 +104,12 @@ func MigrateRepositoryGitData(ctx context.Context, u *user_model.User,
104104
if err := util.RemoveAll(wikiPath); err != nil {
105105
return repo, fmt.Errorf("Failed to remove %s: %v", wikiPath, err)
106106
}
107+
} else {
108+
if err := git.WriteCommitGraph(ctx, wikiPath); err != nil {
109+
return repo, err
110+
}
107111
}
108112
}
109-
if err := git.WriteCommitGraph(ctx, wikiPath); err != nil {
110-
return repo, err
111-
}
112113
}
113114

114115
if repo.OwnerID == u.ID {

modules/setting/log.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,8 @@ func GetLogDescriptions() map[string]*LogDescription {
3232
descs := make(map[string]*LogDescription, len(logDescriptions))
3333
for k, v := range logDescriptions {
3434
subLogDescriptions := make([]SubLogDescription, len(v.SubLogDescriptions))
35-
for i, s := range v.SubLogDescriptions {
36-
subLogDescriptions[i] = s
37-
}
35+
copy(subLogDescriptions, v.SubLogDescriptions)
36+
3837
descs[k] = &LogDescription{
3938
Name: v.Name,
4039
SubLogDescriptions: subLogDescriptions,

options/license/LGPL-3.0-only

Lines changed: 233 additions & 0 deletions
Large diffs are not rendered by default.

options/license/LGPL-3.0-or-later

Lines changed: 233 additions & 0 deletions
Large diffs are not rendered by default.

routers/api/v1/api.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1014,7 +1014,7 @@ func Routes() *web.Route {
10141014
m.Group("/{ref}", func() {
10151015
m.Get("/status", repo.GetCombinedCommitStatusByRef)
10161016
m.Get("/statuses", repo.GetCommitStatusesByRef)
1017-
})
1017+
}, context.ReferencesGitRepo())
10181018
}, reqRepoReader(unit.TypeCode))
10191019
m.Group("/git", func() {
10201020
m.Group("/commits", func() {

routers/api/v1/repo/language.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,7 @@ func GetLanguages(ctx *context.APIContext) {
7676
}
7777

7878
resp := make(languageResponse, len(langs))
79-
for i, v := range langs {
80-
resp[i] = v
81-
}
79+
copy(resp, langs)
8280

8381
ctx.JSON(http.StatusOK, resp)
8482
}

routers/api/v1/utils/git.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
package utils
66

77
import (
8+
"fmt"
89
"net/http"
910

1011
"code.gitea.io/gitea/modules/context"
@@ -35,12 +36,7 @@ func ResolveRefOrSha(ctx *context.APIContext, ref string) string {
3536
// GetGitRefs return git references based on filter
3637
func GetGitRefs(ctx *context.APIContext, filter string) ([]*git.Reference, string, error) {
3738
if ctx.Repo.GitRepo == nil {
38-
var err error
39-
ctx.Repo.GitRepo, err = git.OpenRepository(ctx, ctx.Repo.Repository.RepoPath())
40-
if err != nil {
41-
return nil, "OpenRepository", err
42-
}
43-
defer ctx.Repo.GitRepo.Close()
39+
return nil, "", fmt.Errorf("no open git repo found in context")
4440
}
4541
if len(filter) > 0 {
4642
filter = "refs/" + filter

services/mailer/mail.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,7 @@ func generateAdditionalHeaders(ctx *mailCommentContext, reason string, recipient
367367
//"List-Post": https://github.com/go-gitea/gitea/pull/13585
368368
"List-Unsubscribe": ctx.Issue.HTMLURL(),
369369

370+
"X-Mailer": "Gitea",
370371
"X-Gitea-Reason": reason,
371372
"X-Gitea-Sender": ctx.Doer.DisplayName(),
372373
"X-Gitea-Recipient": recipient.DisplayName(),

services/repository/branch.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ func CreateNewBranch(ctx context.Context, doer *user_model.User, repo *repo_mode
3535

3636
if err := git.Push(ctx, repo.RepoPath(), git.PushOptions{
3737
Remote: repo.RepoPath(),
38-
Branch: fmt.Sprintf("%s:%s%s", oldBranchName, git.BranchPrefix, branchName),
38+
Branch: fmt.Sprintf("%s%s:%s%s", git.BranchPrefix, oldBranchName, git.BranchPrefix, branchName),
3939
Env: models.PushingEnvironment(doer, repo),
4040
}); err != nil {
4141
if git.IsErrPushOutOfDate(err) || git.IsErrPushRejected(err) {

0 commit comments

Comments
 (0)