Skip to content

Commit cc6981e

Browse files
committed
Merge remote-tracking branch 'origin/main' into makesimple
* origin/main: Remove i18n backport tool at the moment because of translation format changed (go-gitea#36643) Fix bug the protected branch rule name is conflicted with renamed branch name (go-gitea#36650) Update JS deps (go-gitea#36656)
2 parents 5079916 + b970cc0 commit cc6981e

10 files changed

Lines changed: 493 additions & 487 deletions

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ Here's how to run the test suite:
183183
## Translation
184184

185185
All translation work happens on [Crowdin](https://translate.gitea.com).
186-
The only translation that is maintained in this repository is [the English translation](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.ini).
186+
The only translation that is maintained in this repository is [the English translation](https://github.com/go-gitea/gitea/blob/main/options/locale/locale_en-US.json).
187187
It is synced regularly with Crowdin. \
188188
Other locales on main branch **should not** be updated manually as they will be overwritten with each sync. \
189189
Once a language has reached a **satisfactory percentage** of translated keys (~25%), it will be synced back into this repo and included in the next released version.

build/backport-locales.go

Lines changed: 0 additions & 115 deletions
This file was deleted.

models/git/branch.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -397,10 +397,16 @@ func RenameBranch(ctx context.Context, repo *repo_model.Repository, from, to str
397397

398398
if protectedBranch != nil {
399399
// there is a protect rule for this branch
400-
protectedBranch.RuleName = to
401-
if _, err = sess.ID(protectedBranch.ID).Cols("branch_name").Update(protectedBranch); err != nil {
400+
existingRule, err := GetProtectedBranchRuleByName(ctx, repo.ID, to)
401+
if err != nil {
402402
return err
403403
}
404+
if existingRule == nil || existingRule.ID == protectedBranch.ID {
405+
protectedBranch.RuleName = to
406+
if _, err = sess.ID(protectedBranch.ID).Cols("branch_name").Update(protectedBranch); err != nil {
407+
return err
408+
}
409+
}
404410
} else {
405411
// some glob protect rules may match this branch
406412
protected, err := IsBranchProtected(ctx, repo.ID, from)

models/git/branch_test.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,53 @@ func TestRenameBranch(t *testing.T) {
159159
})
160160
}
161161

162+
func TestRenameBranchProtectedRuleConflict(t *testing.T) {
163+
assert.NoError(t, unittest.PrepareTestDatabase())
164+
repo1 := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1})
165+
master := unittest.AssertExistsAndLoadBean(t, &git_model.Branch{RepoID: repo1.ID, Name: "master"})
166+
167+
devBranch := &git_model.Branch{
168+
RepoID: repo1.ID,
169+
Name: "dev",
170+
CommitID: master.CommitID,
171+
CommitMessage: master.CommitMessage,
172+
CommitTime: master.CommitTime,
173+
PusherID: master.PusherID,
174+
}
175+
assert.NoError(t, db.Insert(t.Context(), devBranch))
176+
177+
pbDev := git_model.ProtectedBranch{
178+
RepoID: repo1.ID,
179+
RuleName: "dev",
180+
CanPush: true,
181+
}
182+
assert.NoError(t, git_model.UpdateProtectBranch(t.Context(), repo1, &pbDev, git_model.WhitelistOptions{}))
183+
184+
pbMain := git_model.ProtectedBranch{
185+
RepoID: repo1.ID,
186+
RuleName: "main",
187+
CanPush: true,
188+
}
189+
assert.NoError(t, git_model.UpdateProtectBranch(t.Context(), repo1, &pbMain, git_model.WhitelistOptions{}))
190+
191+
assert.NoError(t, git_model.RenameBranch(t.Context(), repo1, "dev", "main", func(ctx context.Context, isDefault bool) error {
192+
return nil
193+
}))
194+
195+
unittest.AssertNotExistsBean(t, &git_model.Branch{RepoID: repo1.ID, Name: "dev"})
196+
unittest.AssertExistsAndLoadBean(t, &git_model.Branch{RepoID: repo1.ID, Name: "main"})
197+
198+
protectedDev, err := git_model.GetProtectedBranchRuleByName(t.Context(), repo1.ID, "dev")
199+
assert.NoError(t, err)
200+
assert.NotNil(t, protectedDev)
201+
assert.Equal(t, "dev", protectedDev.RuleName)
202+
203+
protectedMainByID, err := git_model.GetProtectedBranchRuleByID(t.Context(), repo1.ID, pbMain.ID)
204+
assert.NoError(t, err)
205+
assert.NotNil(t, protectedMainByID)
206+
assert.Equal(t, "main", protectedMainByID.RuleName)
207+
}
208+
162209
func TestOnlyGetDeletedBranchOnCorrectRepo(t *testing.T) {
163210
assert.NoError(t, unittest.PrepareTestDatabase())
164211

package.json

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"type": "module",
3-
"packageManager": "pnpm@10.29.2",
3+
"packageManager": "pnpm@10.30.0",
44
"engines": {
55
"node": ">= 22.6.0",
66
"pnpm": ">= 10.0.0"
@@ -16,20 +16,20 @@
1616
"@github/text-expander-element": "2.9.4",
1717
"@mcaptcha/vanilla-glue": "0.1.0-alpha-3",
1818
"@mermaid-js/layout-elk": "0.2.0",
19-
"@primer/octicons": "19.21.2",
19+
"@primer/octicons": "19.22.0",
2020
"@resvg/resvg-wasm": "2.6.2",
2121
"@silverwind/vue3-calendar-heatmap": "2.1.1",
2222
"@techknowlogick/license-checker-webpack-plugin": "0.3.0",
2323
"add-asset-webpack-plugin": "3.1.1",
2424
"ansi_up": "6.0.6",
25-
"asciinema-player": "3.14.0",
25+
"asciinema-player": "3.14.15",
2626
"chart.js": "4.5.1",
2727
"chartjs-adapter-dayjs-4": "1.0.4",
2828
"chartjs-plugin-zoom": "2.2.0",
2929
"clippie": "4.1.10",
3030
"compare-versions": "6.1.1",
3131
"cropperjs": "1.6.2",
32-
"css-loader": "7.1.3",
32+
"css-loader": "7.1.4",
3333
"dayjs": "1.11.19",
3434
"dropzone": "6.0.0-beta.2",
3535
"easymde": "2.20.0",
@@ -39,17 +39,17 @@
3939
"jquery": "4.0.0",
4040
"js-yaml": "4.1.1",
4141
"katex": "0.16.28",
42-
"mermaid": "11.12.2",
42+
"mermaid": "11.12.3",
4343
"mini-css-extract-plugin": "2.10.0",
4444
"monaco-editor": "0.55.1",
4545
"monaco-editor-webpack-plugin": "7.1.1",
4646
"online-3d-viewer": "0.18.0",
4747
"pdfobject": "2.3.1",
4848
"perfect-debounce": "2.1.0",
4949
"postcss": "8.5.6",
50-
"postcss-loader": "8.2.0",
51-
"sortablejs": "1.15.6",
52-
"swagger-ui-dist": "5.31.0",
50+
"postcss-loader": "8.2.1",
51+
"sortablejs": "1.15.7",
52+
"swagger-ui-dist": "5.31.1",
5353
"tailwindcss": "3.4.17",
5454
"throttle-debounce": "5.0.2",
5555
"tinycolor2": "1.6.0",
@@ -62,7 +62,7 @@
6262
"vue-bar-graph": "2.2.0",
6363
"vue-chartjs": "5.3.3",
6464
"vue-loader": "17.4.2",
65-
"webpack": "5.105.0",
65+
"webpack": "5.105.2",
6666
"webpack-cli": "6.0.1",
6767
"wrap-ansi": "9.0.2"
6868
},
@@ -84,38 +84,38 @@
8484
"@types/throttle-debounce": "5.0.2",
8585
"@types/tinycolor2": "1.4.6",
8686
"@types/toastify-js": "1.12.4",
87-
"@typescript-eslint/parser": "8.55.0",
87+
"@typescript-eslint/parser": "8.56.0",
8888
"@vitejs/plugin-vue": "6.0.4",
89-
"@vitest/eslint-plugin": "1.6.7",
89+
"@vitest/eslint-plugin": "1.6.9",
9090
"eslint": "9.39.2",
9191
"eslint-import-resolver-typescript": "4.4.4",
9292
"eslint-plugin-array-func": "5.1.0",
9393
"eslint-plugin-github": "6.0.0",
9494
"eslint-plugin-import-x": "4.16.1",
9595
"eslint-plugin-playwright": "2.5.1",
9696
"eslint-plugin-regexp": "3.0.0",
97-
"eslint-plugin-sonarjs": "3.0.6",
98-
"eslint-plugin-unicorn": "62.0.0",
99-
"eslint-plugin-vue": "10.7.0",
97+
"eslint-plugin-sonarjs": "3.0.7",
98+
"eslint-plugin-unicorn": "63.0.0",
99+
"eslint-plugin-vue": "10.8.0",
100100
"eslint-plugin-vue-scoped-css": "2.12.0",
101101
"eslint-plugin-wc": "3.1.0",
102102
"globals": "17.3.0",
103-
"happy-dom": "20.6.0",
103+
"happy-dom": "20.6.1",
104104
"jiti": "2.6.1",
105105
"markdownlint-cli": "0.47.0",
106106
"material-icon-theme": "5.31.0",
107107
"nolyfill": "1.0.44",
108108
"postcss-html": "1.8.1",
109-
"spectral-cli-bundle": "1.0.4",
110-
"stylelint": "17.1.1",
109+
"spectral-cli-bundle": "1.0.7",
110+
"stylelint": "17.3.0",
111111
"stylelint-config-recommended": "18.0.0",
112112
"stylelint-declaration-block-no-ignored-properties": "3.0.0",
113113
"stylelint-declaration-strict-value": "1.10.11",
114114
"stylelint-value-no-unknown-custom-properties": "6.1.1",
115115
"svgo": "4.0.0",
116116
"typescript": "5.9.3",
117-
"typescript-eslint": "8.55.0",
118-
"updates": "17.4.0",
117+
"typescript-eslint": "8.56.0",
118+
"updates": "17.5.7",
119119
"vite-string-plugin": "2.0.1",
120120
"vitest": "4.0.18",
121121
"vue-tsc": "3.2.4"

0 commit comments

Comments
 (0)