From 40cd885c11bff95ba2adf920373e3d9ab4c0e938 Mon Sep 17 00:00:00 2001 From: GiteaBot Date: Mon, 17 Jun 2024 00:27:39 +0000 Subject: [PATCH 01/12] [skip ci] Updated licenses and gitignores (cherry picked from commit 129206da4543f2024601af20dac3eaf978d0c432) --- options/gitignore/IAR | 47 +++++++++++++++++++++++++++++++++++ options/gitignore/Objective-C | 7 ------ options/gitignore/Terraform | 3 --- 3 files changed, 47 insertions(+), 10 deletions(-) create mode 100644 options/gitignore/IAR diff --git a/options/gitignore/IAR b/options/gitignore/IAR new file mode 100644 index 000000000..e8938b31a --- /dev/null +++ b/options/gitignore/IAR @@ -0,0 +1,47 @@ +# Compiled binaries +*.o +*.bin +*.elf +*.hex +*.map +*.out +*.obj + +# Trash +*.bak +thumbs.db +*.~* + +# IAR Settings +**/settings/*.crun +**/settings/*.dbgdt +**/settings/*.cspy +**/settings/*.cspy.* +**/settings/*.xcl +**/settings/*.dni +**/settings/*.wsdt +**/settings/*.wspos + +# IAR Debug Exe +**/Exe/*.sim + +# IAR Debug Obj +**/Obj/*.pbd +**/Obj/*.pbd.* +**/Obj/*.pbi +**/Obj/*.pbi.* + +# IAR project "Debug" directory +Debug/ + +# IAR project "Release" directory +Release/ + +# IAR project settings directory +settings/ + +# IAR backup files +Backup* + +# IAR .dep files +*.dep \ No newline at end of file diff --git a/options/gitignore/Objective-C b/options/gitignore/Objective-C index 9b8cd0706..2ebce16e6 100644 --- a/options/gitignore/Objective-C +++ b/options/gitignore/Objective-C @@ -42,10 +42,3 @@ fastlane/report.xml fastlane/Preview.html fastlane/screenshots/**/*.png fastlane/test_output - -# Code Injection -# -# After new code Injection tools there's a generated folder /iOSInjectionProject -# https://github.com/johnno1962/injectionforxcode - -iOSInjectionProject/ diff --git a/options/gitignore/Terraform b/options/gitignore/Terraform index 15073ca88..2faf43d0a 100644 --- a/options/gitignore/Terraform +++ b/options/gitignore/Terraform @@ -35,6 +35,3 @@ override.tf.json # Ignore CLI configuration files .terraformrc terraform.rc - -# Ignore hcl file -.terraform.lock.hcl From 77da92f42a70909a8b68ac9730eed08f1fa90aa6 Mon Sep 17 00:00:00 2001 From: 6543 <6543@obermui.de> Date: Mon, 17 Jun 2024 21:22:39 +0200 Subject: [PATCH 02/12] Add cache test for admins (#31265) Add a test to probe the cache similar to the email test func. ![image](https://github.com/go-gitea/gitea/assets/24977596/700e2733-586d-4091-900f-f5f71e6e94bf) ![image](https://github.com/go-gitea/gitea/assets/24977596/2a953802-18fc-4e81-a37d-24ebe1297365) ![image](https://github.com/go-gitea/gitea/assets/24977596/e00d62ad-bb60-41cc-9138-09993daee156) --------- Co-authored-by: delvh Co-authored-by: silverwind (cherry picked from commit 363c1235987793dffa5cc851aaae585eb81f091e) Conflicts: options/locale/locale_en-US.ini templates/admin/self_check.tmpl trivial context conflict --- modules/cache/cache.go | 31 +++++++++++++++++++++++++++++++ modules/cache/cache_test.go | 12 ++++++++++++ options/locale/locale_en-US.ini | 6 ++++++ routers/web/admin/admin.go | 9 +++++++++ routers/web/admin/config.go | 17 +++++++++++++++++ routers/web/web.go | 1 + templates/admin/config.tmpl | 12 ++++++++++-- templates/admin/self_check.tmpl | 7 +++++++ 8 files changed, 93 insertions(+), 2 deletions(-) diff --git a/modules/cache/cache.go b/modules/cache/cache.go index 09afc8b7f..178af97bb 100644 --- a/modules/cache/cache.go +++ b/modules/cache/cache.go @@ -40,6 +40,37 @@ func Init() error { return err } +const ( + testCacheKey = "DefaultCache.TestKey" + SlowCacheThreshold = 100 * time.Microsecond +) + +func Test() (time.Duration, error) { + if defaultCache == nil { + return 0, fmt.Errorf("default cache not initialized") + } + + testData := fmt.Sprintf("%x", make([]byte, 500)) + + start := time.Now() + + if err := defaultCache.Delete(testCacheKey); err != nil { + return 0, fmt.Errorf("expect cache to delete data based on key if exist but got: %w", err) + } + if err := defaultCache.Put(testCacheKey, testData, 10); err != nil { + return 0, fmt.Errorf("expect cache to store data but got: %w", err) + } + testVal, hit := defaultCache.Get(testCacheKey) + if !hit { + return 0, fmt.Errorf("expect cache hit but got none") + } + if testVal != testData { + return 0, fmt.Errorf("expect cache to return same value as stored but got other") + } + + return time.Since(start), nil +} + // GetCache returns the currently configured cache func GetCache() mc.Cache { return conn diff --git a/modules/cache/cache_test.go b/modules/cache/cache_test.go index 3f6504092..d3e108f11 100644 --- a/modules/cache/cache_test.go +++ b/modules/cache/cache_test.go @@ -34,6 +34,18 @@ func TestNewContext(t *testing.T) { assert.Nil(t, con) } +func TestTest(t *testing.T) { + defaultCache = nil + _, err := Test() + assert.Error(t, err) + + createTestCache() + elapsed, err := Test() + assert.NoError(t, err) + // mem cache should take from 300ns up to 1ms on modern hardware ... + assert.Less(t, elapsed, SlowCacheThreshold) +} + func TestGetCache(t *testing.T) { createTestCache() diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index a6a3446ca..5b34670e4 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -93,6 +93,7 @@ remove_all = Remove all remove_label_str = Remove item "%s" edit = Edit view = View +test = Test enabled = Enabled disabled = Disabled @@ -3317,6 +3318,11 @@ config.cache_interval = Cache interval config.cache_conn = Cache connection config.cache_item_ttl = Cache item TTL +config.cache_test = Test Cache +config.cache_test_failed = Failed to probe the cache: %v. +config.cache_test_slow = Cache test successful, but response is slow: %s. +config.cache_test_succeeded = Cache test successful, got a response in %s. + config.session_config = Session configuration config.session_provider = Session provider config.provider_config = Provider config diff --git a/routers/web/admin/admin.go b/routers/web/admin/admin.go index 6c778c686..067203b28 100644 --- a/routers/web/admin/admin.go +++ b/routers/web/admin/admin.go @@ -14,6 +14,7 @@ import ( activities_model "code.gitea.io/gitea/models/activities" "code.gitea.io/gitea/models/db" "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/cache" "code.gitea.io/gitea/modules/graceful" "code.gitea.io/gitea/modules/log" "code.gitea.io/gitea/modules/setting" @@ -211,6 +212,14 @@ func SelfCheck(ctx *context.Context) { ctx.Data["DatabaseCheckHasProblems"] = hasProblem } + + elapsed, err := cache.Test() + if err != nil { + ctx.Data["CacheError"] = err + } else if elapsed > cache.SlowCacheThreshold { + ctx.Data["CacheSlow"] = fmt.Sprint(elapsed) + } + ctx.HTML(http.StatusOK, tplSelfCheck) } diff --git a/routers/web/admin/config.go b/routers/web/admin/config.go index 22f260ede..09f332b44 100644 --- a/routers/web/admin/config.go +++ b/routers/web/admin/config.go @@ -12,6 +12,7 @@ import ( system_model "code.gitea.io/gitea/models/system" "code.gitea.io/gitea/modules/base" + "code.gitea.io/gitea/modules/cache" "code.gitea.io/gitea/modules/git" "code.gitea.io/gitea/modules/json" "code.gitea.io/gitea/modules/log" @@ -42,6 +43,22 @@ func SendTestMail(ctx *context.Context) { ctx.Redirect(setting.AppSubURL + "/admin/config") } +// TestCache test the cache settings +func TestCache(ctx *context.Context) { + elapsed, err := cache.Test() + if err != nil { + ctx.Flash.Error(ctx.Tr("admin.config.cache_test_failed", err)) + } else { + if elapsed > cache.SlowCacheThreshold { + ctx.Flash.Warning(ctx.Tr("admin.config.cache_test_slow", elapsed)) + } else { + ctx.Flash.Info(ctx.Tr("admin.config.cache_test_succeeded", elapsed)) + } + } + + ctx.Redirect(setting.AppSubURL + "/admin/config") +} + func shadowPasswordKV(cfgItem, splitter string) string { fields := strings.Split(cfgItem, splitter) for i := 0; i < len(fields); i++ { diff --git a/routers/web/web.go b/routers/web/web.go index 34bfb8b60..3781ffc05 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -665,6 +665,7 @@ func registerRoutes(m *web.Route) { m.Get("", admin.Config) m.Post("", admin.ChangeConfig) m.Post("/test_mail", admin.SendTestMail) + m.Post("/test_cache", admin.TestCache) m.Get("/settings", admin.ConfigSettings) }) diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index d4e5b326f..8f2b1c12e 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -233,8 +233,8 @@
{{ctx.Locale.Tr "admin.config.mailer_user"}}
{{if .Mailer.User}}{{.Mailer.User}}{{else}}(empty){{end}}
-
{{ctx.Locale.Tr "admin.config.send_test_mail"}}
-
+
{{ctx.Locale.Tr "admin.config.send_test_mail"}}
+
{{.CsrfTokenHtml}}
@@ -264,6 +264,14 @@
{{ctx.Locale.Tr "admin.config.cache_item_ttl"}}
{{.CacheItemTTL}}
{{end}} +
+
{{ctx.Locale.Tr "admin.config.cache_test"}}
+
+ + {{.CsrfTokenHtml}} + +
+
diff --git a/templates/admin/self_check.tmpl b/templates/admin/self_check.tmpl index 5c154ac0d..afcd4cd64 100644 --- a/templates/admin/self_check.tmpl +++ b/templates/admin/self_check.tmpl @@ -28,6 +28,13 @@ {{else}}
{{ctx.Locale.Tr "admin.self_check.no_problem_found"}}
{{end}} + + {{if .CacheError}} +
{{ctx.Locale.Tr "admin.config.cache_test_failed" .CacheError}}
+ {{end}} + {{if .CacheSlow}} +
{{ctx.Locale.Tr "admin.config.cache_test_slow" .CacheSlow}}
+ {{end}} From 9c48511c696569930f8c529e2e7aa6494faa3aa6 Mon Sep 17 00:00:00 2001 From: Earl Warren Date: Sun, 23 Jun 2024 11:38:35 +0200 Subject: [PATCH 03/12] [PORT] Add cache test for admins (#31265) * the cache was not refactored in Forgejo * fix the test modifying a global variable --- modules/cache/cache.go | 11 ++++++----- modules/cache/cache_test.go | 3 ++- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/modules/cache/cache.go b/modules/cache/cache.go index 178af97bb..546c54dfe 100644 --- a/modules/cache/cache.go +++ b/modules/cache/cache.go @@ -6,6 +6,7 @@ package cache import ( "fmt" "strconv" + "time" "code.gitea.io/gitea/modules/setting" @@ -46,7 +47,7 @@ const ( ) func Test() (time.Duration, error) { - if defaultCache == nil { + if conn == nil { return 0, fmt.Errorf("default cache not initialized") } @@ -54,14 +55,14 @@ func Test() (time.Duration, error) { start := time.Now() - if err := defaultCache.Delete(testCacheKey); err != nil { + if err := conn.Delete(testCacheKey); err != nil { return 0, fmt.Errorf("expect cache to delete data based on key if exist but got: %w", err) } - if err := defaultCache.Put(testCacheKey, testData, 10); err != nil { + if err := conn.Put(testCacheKey, testData, 10); err != nil { return 0, fmt.Errorf("expect cache to store data but got: %w", err) } - testVal, hit := defaultCache.Get(testCacheKey) - if !hit { + testVal := conn.Get(testCacheKey) + if testVal == nil { return 0, fmt.Errorf("expect cache hit but got none") } if testVal != testData { diff --git a/modules/cache/cache_test.go b/modules/cache/cache_test.go index d3e108f11..0e7e7a647 100644 --- a/modules/cache/cache_test.go +++ b/modules/cache/cache_test.go @@ -9,6 +9,7 @@ import ( "time" "code.gitea.io/gitea/modules/setting" + "code.gitea.io/gitea/modules/test" "github.com/stretchr/testify/assert" ) @@ -35,7 +36,7 @@ func TestNewContext(t *testing.T) { } func TestTest(t *testing.T) { - defaultCache = nil + defer test.MockVariableValue(&conn, nil)() _, err := Test() assert.Error(t, err) From 75bbca68ce0b6a13e94a5147311afcb800819f5e Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Tue, 18 Jun 2024 06:56:45 +0800 Subject: [PATCH 04/12] Refactor markup code (#31399) 1. use clearer names 2. remove deadcode 3. avoid name shadowing 4. eliminate some lint warnings (cherry picked from commit 5a7376c0605415e63cb5b3b8f89ead01e567229b) Conflicts: modules/markup/html.go simple code divergence, trivial logic --- .deadcode-out | 1 - modules/markup/html.go | 25 ++++++------------------- modules/markup/html_test.go | 11 ----------- 3 files changed, 6 insertions(+), 31 deletions(-) diff --git a/.deadcode-out b/.deadcode-out index 186e1ef4e..e05289247 100644 --- a/.deadcode-out +++ b/.deadcode-out @@ -210,7 +210,6 @@ code.gitea.io/gitea/modules/json StdJSON.Indent code.gitea.io/gitea/modules/markup - IsSameDomain GetRendererByType RenderString IsMarkupFile diff --git a/modules/markup/html.go b/modules/markup/html.go index 93c72fdcb..b5c0e405a 100644 --- a/modules/markup/html.go +++ b/modules/markup/html.go @@ -143,20 +143,6 @@ func CustomLinkURLSchemes(schemes []string) { common.LinkRegex, _ = xurls.StrictMatchingScheme(strings.Join(withAuth, "|")) } -// IsSameDomain checks if given url string has the same hostname as current Gitea instance -func IsSameDomain(s string) bool { - if strings.HasPrefix(s, "/") { - return true - } - if uapp, err := url.Parse(setting.AppURL); err == nil { - if u, err := url.Parse(s); err == nil { - return u.Host == uapp.Host - } - return false - } - return false -} - type postProcessError struct { context string err error @@ -393,7 +379,7 @@ func visitNode(ctx *RenderContext, procs []processor, node *html.Node) { // We ignore code and pre. switch node.Type { case html.TextNode: - textNode(ctx, procs, node) + processTextNodes(ctx, procs, node) case html.ElementNode: if node.Data == "img" { for i, attr := range node.Attr { @@ -436,15 +422,16 @@ func visitNode(ctx *RenderContext, procs []processor, node *html.Node) { for n := node.FirstChild; n != nil; n = n.NextSibling { visitNode(ctx, procs, n) } + default: } // ignore everything else } -// textNode runs the passed node through various processors, in order to handle +// processTextNodes runs the passed node through various processors, in order to handle // all kinds of special links handled by the post-processing. -func textNode(ctx *RenderContext, procs []processor, node *html.Node) { - for _, processor := range procs { - processor(ctx, node) +func processTextNodes(ctx *RenderContext, procs []processor, node *html.Node) { + for _, p := range procs { + p(ctx, node) } } diff --git a/modules/markup/html_test.go b/modules/markup/html_test.go index cfd1a66a1..fa49e60a1 100644 --- a/modules/markup/html_test.go +++ b/modules/markup/html_test.go @@ -135,17 +135,6 @@ func TestRender_CrossReferences(t *testing.T) { `

`+sha[:10]+`/README.md (L1-L5)

`) } -func TestMisc_IsSameDomain(t *testing.T) { - setting.AppURL = markup.TestAppURL - - sha := "b6dd6210eaebc915fd5be5579c58cce4da2e2579" - commit := util.URLJoin(markup.TestRepoURL, "commit", sha) - - assert.True(t, markup.IsSameDomain(commit)) - assert.False(t, markup.IsSameDomain("http://google.com/ncr")) - assert.False(t, markup.IsSameDomain("favicon.ico")) -} - func TestRender_links(t *testing.T) { setting.AppURL = markup.TestAppURL From cdefd617d0339604f4baadf563235646532164f5 Mon Sep 17 00:00:00 2001 From: Tobias Balle-Petersen Date: Wed, 19 Jun 2024 16:36:09 +0200 Subject: [PATCH 05/12] Increase max length of org team names from 30 to 255 characters (#31410) This PR modifies the structs for editing and creating org teams to allow team names to be up to 255 characters. The previous maximum length was 30 characters. (cherry picked from commit 1c26127b520858671ce257c7c9ab978ed1e95252) --- modules/structs/org_team.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/structs/org_team.go b/modules/structs/org_team.go index 78dc4abae..f8899b236 100644 --- a/modules/structs/org_team.go +++ b/modules/structs/org_team.go @@ -24,7 +24,7 @@ type Team struct { // CreateTeamOption options for creating a team type CreateTeamOption struct { // required: true - Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"` + Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(255)"` Description string `json:"description" binding:"MaxSize(255)"` IncludesAllRepositories bool `json:"includes_all_repositories"` // enum: read,write,admin @@ -40,7 +40,7 @@ type CreateTeamOption struct { // EditTeamOption options for editing a team type EditTeamOption struct { // required: true - Name string `json:"name" binding:"AlphaDashDot;MaxSize(30)"` + Name string `json:"name" binding:"AlphaDashDot;MaxSize(255)"` Description *string `json:"description" binding:"MaxSize(255)"` IncludesAllRepositories *bool `json:"includes_all_repositories"` // enum: read,write,admin From 4ebe8c127016f97c1e4b27e468b81738d5c93a40 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 19 Jun 2024 21:42:06 +0200 Subject: [PATCH 06/12] Reduce `air` verbosity (#31417) Make `air` log less. Uses the option added in https://github.com/air-verse/air/pull/367. (cherry picked from commit 1c1545268743d7d4536a5ff2a137af7c255f45c8) --- .air.toml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.air.toml b/.air.toml index d506c1942..af182697f 100644 --- a/.air.toml +++ b/.air.toml @@ -24,3 +24,6 @@ exclude_dir = [ ] exclude_regex = ["_test.go$", "_gen.go$"] stop_on_error = true + +[log] +main_only = true From b53be9d45c7f12c9a8c8f3c9b71340d37dfc9fec Mon Sep 17 00:00:00 2001 From: charles <30816317+charles7668@users.noreply.github.com> Date: Thu, 20 Jun 2024 10:12:54 +0800 Subject: [PATCH 07/12] Fix markdown math brackets render problem (#31420) Close #31371, support `($ ... $)` like GitHub Co-authored-by: wxiaoguang (cherry picked from commit 90a3c20e7996e2db577a51d37f2190e2e990a22a) Conflicts: modules/markup/markdown/markdown_test.go trivial context conflict --- modules/markup/markdown/markdown_test.go | 4 ++++ modules/markup/markdown/math/inline_parser.go | 6 +++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modules/markup/markdown/markdown_test.go b/modules/markup/markdown/markdown_test.go index 1e25df432..68428552c 100644 --- a/modules/markup/markdown/markdown_test.go +++ b/modules/markup/markdown/markdown_test.go @@ -548,6 +548,10 @@ func TestMathBlock(t *testing.T) { `$$a`, `

$$a

` + nl, }, + { + "$a$ ($b$) [$c$] {$d$}", + `

a (b) [$c$] {$d$}

` + nl, + }, } for _, test := range testcases { diff --git a/modules/markup/markdown/math/inline_parser.go b/modules/markup/markdown/math/inline_parser.go index 862234e69..614cf329a 100644 --- a/modules/markup/markdown/math/inline_parser.go +++ b/modules/markup/markdown/math/inline_parser.go @@ -45,6 +45,10 @@ func isPunctuation(b byte) bool { return b == '.' || b == '!' || b == '?' || b == ',' || b == ';' || b == ':' } +func isBracket(b byte) bool { + return b == ')' +} + func isAlphanumeric(b byte) bool { return (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || (b >= '0' && b <= '9') } @@ -84,7 +88,7 @@ func (parser *inlineParser) Parse(parent ast.Node, block text.Reader, pc parser. break } suceedingCharacter := line[pos] - if !isPunctuation(suceedingCharacter) && !(suceedingCharacter == ' ') { + if !isPunctuation(suceedingCharacter) && !(suceedingCharacter == ' ') && !isBracket(suceedingCharacter) { return nil } if line[ender-1] != '\\' { From 979eb1aa0cf10d96d3fb8ee3f7b935e87f32c21b Mon Sep 17 00:00:00 2001 From: Sumit Date: Thu, 20 Jun 2024 18:54:53 +0530 Subject: [PATCH 08/12] [Fix] Account Linking UpdateMigrationsByType (#31428) Fix https://github.com/go-gitea/gitea/issues/31427 (cherry picked from commit 17b3a38577d6e1d50ba5565ca3b1f2f57a04bf32) --- services/externalaccount/user.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/services/externalaccount/user.go b/services/externalaccount/user.go index e2de41da1..3cfd8c81f 100644 --- a/services/externalaccount/user.go +++ b/services/externalaccount/user.go @@ -5,6 +5,7 @@ package externalaccount import ( "context" + "strconv" "strings" "code.gitea.io/gitea/models/auth" @@ -82,6 +83,11 @@ func UpdateExternalUser(ctx context.Context, user *user_model.User, gothUser got // UpdateMigrationsByType updates all migrated repositories' posterid from gitServiceType to replace originalAuthorID to posterID func UpdateMigrationsByType(ctx context.Context, tp structs.GitServiceType, externalUserID string, userID int64) error { + // Skip update if externalUserID is not a valid numeric ID or exceeds int64 + if _, err := strconv.ParseInt(externalUserID, 10, 64); err != nil { + return nil + } + if err := issues_model.UpdateIssuesMigrationsByType(ctx, tp, externalUserID, userID); err != nil { return err } From 585d62c0cd90e2da25e2da00bf4e82ad92604ec3 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Thu, 20 Jun 2024 18:54:19 +0200 Subject: [PATCH 09/12] Fix labels and projects menu overflow on issue page (#31435) It was correct only on the new issue page. Resolves #31415 (cherry picked from commit 5afafe22a34183c9c053a7ceac2c9dc05d9943e2) --- web_src/css/repo.css | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web_src/css/repo.css b/web_src/css/repo.css index 4ca8148fb..f52804ff2 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -79,6 +79,11 @@ white-space: nowrap; } +.repository .issue-content-right .filter.menu { + max-height: 500px; + overflow-x: auto; +} + .repository .filter.menu.labels .label-filter .menu .info { display: inline-block; padding: 0.5rem 0; @@ -581,11 +586,6 @@ td .commit-summary { font-size: 14px; } -.repository.new.issue .comment.form .issue-content-right .filter.menu { - max-height: 500px; - overflow-x: auto; -} - .repository.view.issue .instruct-toggle { display: inline-block; } From 59532d93ef6d20b5f2b2f3cd7615ff41983d67e2 Mon Sep 17 00:00:00 2001 From: charles <30816317+charles7668@users.noreply.github.com> Date: Fri, 21 Jun 2024 01:43:42 +0800 Subject: [PATCH 10/12] Fix the wrong line number in the diff view page when expanded twice. (#31431) close #31149, regression of #29385 (incorrect `data-query=`) (cherry picked from commit c60ef946b1c5ed3347224cda5d3e17592cd16e5e) Conflicts: templates/repo/diff/blob_excerpt.tmpl trivial context conflict --- templates/repo/diff/blob_excerpt.tmpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/templates/repo/diff/blob_excerpt.tmpl b/templates/repo/diff/blob_excerpt.tmpl index 8312b5d91..d6ab87fdc 100644 --- a/templates/repo/diff/blob_excerpt.tmpl +++ b/templates/repo/diff/blob_excerpt.tmpl @@ -51,17 +51,17 @@
{{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 5)}} - {{end}} {{if or (eq $line.GetExpandDirection 3) (eq $line.GetExpandDirection 4)}} - {{end}} {{if eq $line.GetExpandDirection 2}} - {{end}} From d42165f0bbcfb858d3a224d55db8ac3c0dd38e2b Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Fri, 21 Jun 2024 07:28:34 +0800 Subject: [PATCH 11/12] Fix the link for .git-blame-ignore-revs bypass (#31432) A quick fix for #31429 (cherry picked from commit ed5ded3ff86fc7c3eccfe28e59b30728e6bf9fbc) --- templates/repo/blame.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/repo/blame.tmpl b/templates/repo/blame.tmpl index 01978dacf..691f75dca 100644 --- a/templates/repo/blame.tmpl +++ b/templates/repo/blame.tmpl @@ -2,7 +2,7 @@ {{$revsFileLink := URLJoin .RepoLink "src" .BranchNameSubURL "/.git-blame-ignore-revs"}} {{if .UsesIgnoreRevs}}
-

{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink (print $revsFileLink "?bypass-blame-ignore=true")}}

+

{{ctx.Locale.Tr "repo.blame.ignore_revs" $revsFileLink "?bypass-blame-ignore=true"}}

{{else}}
From 374964cd0716a3305267e496453cdf709abe9266 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 21 Jun 2024 17:08:42 +0200 Subject: [PATCH 12/12] Fix deprecated Dockerfile ENV format (#31450) See https://docs.docker.com/reference/build-checks/legacy-key-value-format/. Fixes these warnings seen during the docker build: ``` 4 warnings found (use --debug to expand): - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 5) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 9) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 75) - LegacyKeyValueFormat: "ENV key=value" should be used instead of legacy "ENV key value" format (line 76) ``` Introduced in: https://github.com/moby/buildkit/pull/4923 (cherry picked from commit 996037fb6a61b1a7f9a0a837fd87bbeab9cad154) Conflicts: Dockerfile.rootless trivial context conflict --- Dockerfile | 8 ++++---- Dockerfile.rootless | 18 +++++++++--------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index c5b472cbb..eba2fb97d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,11 +3,11 @@ FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env ARG GOPROXY -ENV GOPROXY ${GOPROXY:-direct} +ENV GOPROXY=${GOPROXY:-direct} ARG RELEASE_VERSION ARG TAGS="sqlite sqlite_unlock_notify" -ENV TAGS "bindata timetzdata $TAGS" +ENV TAGS="bindata timetzdata $TAGS" ARG CGO_EXTRA_CFLAGS # @@ -92,8 +92,8 @@ RUN addgroup \ git && \ echo "git:*" | chpasswd -e -ENV USER git -ENV GITEA_CUSTOM /data/gitea +ENV USER=git +ENV GITEA_CUSTOM=/data/gitea VOLUME ["/data"] diff --git a/Dockerfile.rootless b/Dockerfile.rootless index 484711a93..e25532805 100644 --- a/Dockerfile.rootless +++ b/Dockerfile.rootless @@ -3,11 +3,11 @@ FROM --platform=$BUILDPLATFORM docker.io/tonistiigi/xx AS xx FROM --platform=$BUILDPLATFORM code.forgejo.org/oci/golang:1.22-alpine3.20 as build-env ARG GOPROXY -ENV GOPROXY ${GOPROXY:-direct} +ENV GOPROXY=${GOPROXY:-direct} ARG RELEASE_VERSION ARG TAGS="sqlite sqlite_unlock_notify" -ENV TAGS "bindata timetzdata $TAGS" +ENV TAGS="bindata timetzdata $TAGS" ARG CGO_EXTRA_CFLAGS # @@ -95,17 +95,17 @@ COPY --from=build-env /go/src/code.gitea.io/gitea/contrib/autocompletion/bash_au #git:git USER 1000:1000 -ENV GITEA_WORK_DIR /var/lib/gitea -ENV GITEA_CUSTOM /var/lib/gitea/custom -ENV GITEA_TEMP /tmp/gitea -ENV TMPDIR /tmp/gitea +ENV GITEA_WORK_DIR=/var/lib/gitea +ENV GITEA_CUSTOM=/var/lib/gitea/custom +ENV GITEA_TEMP=/tmp/gitea +ENV TMPDIR=/tmp/gitea # Legacy config file for backwards compatibility # TODO: remove on next major version release -ENV GITEA_APP_INI_LEGACY /etc/gitea/app.ini +ENV GITEA_APP_INI_LEGACY=/etc/gitea/app.ini -ENV GITEA_APP_INI ${GITEA_CUSTOM}/conf/app.ini -ENV HOME "/var/lib/gitea/git" +ENV GITEA_APP_INI=${GITEA_CUSTOM}/conf/app.ini +ENV HOME="/var/lib/gitea/git" VOLUME ["/var/lib/gitea", "/etc/gitea"] WORKDIR /var/lib/gitea