Skip to content

Commit 3688b8d

Browse files
committed
Merge branch 'main' of https://github.com/go-gitea/gitea into fix-null-fields
2 parents b8dd4f2 + fa0e2d6 commit 3688b8d

File tree

52 files changed

+1672
-1042
lines changed

Some content is hidden

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

52 files changed

+1672
-1042
lines changed

.eslintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,7 @@ rules:
442442
unicorn/require-post-message-target-origin: [0]
443443
unicorn/string-content: [0]
444444
unicorn/template-indent: [2]
445+
unicorn/text-encoding-identifier-case: [0]
445446
unicorn/throw-new-error: [2]
446447
use-isnan: [2]
447448
valid-typeof: [2, {requireStringLiterals: true}]

.stylelintrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ rules:
1414
declaration-block-no-redundant-longhand-properties: null
1515
declaration-block-single-line-max-declarations: null
1616
declaration-empty-line-before: null
17+
function-no-unknown: null
1718
hue-degree-notation: null
1819
indentation: 2
1920
max-line-length: null

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ clean:
235235
.PHONY: fmt
236236
fmt:
237237
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
238-
$(GO) install mvdan.cc/gofumpt@latest; \
238+
$(GO) install mvdan.cc/gofumpt@v0.3.0; \
239239
fi
240240
@echo "Running gitea-fmt (with gofumpt)..."
241241
@$(GO) run build/code-batch-process.go gitea-fmt -w '{file-list}'
@@ -287,7 +287,7 @@ errcheck:
287287
.PHONY: fmt-check
288288
fmt-check:
289289
@hash gofumpt > /dev/null 2>&1; if [ $$? -ne 0 ]; then \
290-
$(GO) install mvdan.cc/gofumpt@latest; \
290+
$(GO) install mvdan.cc/gofumpt@0.3.0; \
291291
fi
292292
# get all go files and run gitea-fmt (with gofmt) on them
293293
@diff=$$($(GO) run build/code-batch-process.go gitea-fmt -l '{file-list}'); \

custom/conf/app.example.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,7 @@ PATH =
11151115
;SEARCH_REPO_DESCRIPTION = true
11161116
;;
11171117
;; Whether to enable a Service Worker to cache frontend assets
1118-
;USE_SERVICE_WORKER = true
1118+
;USE_SERVICE_WORKER = false
11191119

11201120
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11211121
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
189189
add it to this config.
190190
- `DEFAULT_SHOW_FULL_NAME`: **false**: Whether the full name of the users should be shown where possible. If the full name isn't set, the username will be used.
191191
- `SEARCH_REPO_DESCRIPTION`: **true**: Whether to search within description at repository search on explore page.
192-
- `USE_SERVICE_WORKER`: **true**: Whether to enable a Service Worker to cache frontend assets.
192+
- `USE_SERVICE_WORKER`: **false**: Whether to enable a Service Worker to cache frontend assets.
193193

194194
### UI - Admin (`ui.admin`)
195195

docs/content/doc/developers/hacking-on-gitea.en-us.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ Before committing, make sure the linters pass:
185185
make lint-frontend
186186
```
187187

188-
Note: When working on frontend code, set `USE_SERVICE_WORKER` to `false` in `app.ini` to prevent undesirable caching of frontend assets.
189-
190188
### Configuring local ElasticSearch instance
191189

192190
Start local ElasticSearch instance using docker:
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
ref: refs/heads/main
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
[core]
2+
bare = true
3+
repositoryformatversion = 0
4+
filemode = false
5+
symlinks = false
6+
ignorecase = true

integrations/testlogger.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,11 @@ func (log *TestLogger) Init(config string) error {
181181
return nil
182182
}
183183

184+
// Content returns the content accumulated in the content provider
185+
func (log *TestLogger) Content() (string, error) {
186+
return "", fmt.Errorf("not supported")
187+
}
188+
184189
// Flush when log should be flushed
185190
func (log *TestLogger) Flush() {
186191
}

models/fixtures/repository.yml

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
owner_name: user2
2525
lower_name: repo2
2626
name: repo2
27+
is_empty: false
2728
is_archived: false
2829
is_private: true
2930
num_issues: 2
@@ -41,6 +42,7 @@
4142
lower_name: repo3
4243
name: repo3
4344
is_archived: false
45+
is_empty: false
4446
is_private: true
4547
num_issues: 1
4648
num_closed_issues: 0
@@ -57,6 +59,7 @@
5759
owner_name: user5
5860
lower_name: repo4
5961
name: repo4
62+
is_empty: false
6063
is_private: false
6164
num_issues: 0
6265
num_closed_issues: 0
@@ -144,6 +147,7 @@
144147
owner_name: user12
145148
lower_name: repo10
146149
name: repo10
150+
is_empty: false
147151
is_private: false
148152
num_issues: 0
149153
num_closed_issues: 0
@@ -161,6 +165,7 @@
161165
owner_name: user13
162166
lower_name: repo11
163167
name: repo11
168+
is_empty: false
164169
is_private: false
165170
num_issues: 0
166171
num_closed_issues: 0
@@ -218,7 +223,8 @@
218223
owner_name: user2
219224
lower_name: repo15
220225
name: repo15
221-
is_empty: true
226+
is_empty: false
227+
is_private: true
222228
status: 0
223229

224230
-
@@ -227,6 +233,7 @@
227233
owner_name: user2
228234
lower_name: repo16
229235
name: repo16
236+
is_empty: false
230237
is_private: true
231238
num_issues: 0
232239
num_closed_issues: 0
@@ -460,6 +467,8 @@
460467
owner_name: user2
461468
lower_name: repo20
462469
name: repo20
470+
is_empty: false
471+
is_private: true
463472
num_stars: 0
464473
num_forks: 0
465474
num_issues: 0
@@ -485,6 +494,7 @@
485494
owner_name: user2
486495
lower_name: utf8
487496
name: utf8
497+
is_empty: false
488498
is_private: false
489499
status: 0
490500

@@ -520,6 +530,7 @@
520530
owner_name: user2
521531
lower_name: commits_search_test
522532
name: commits_search_test
533+
is_empty: false
523534
is_private: false
524535
num_stars: 0
525536
num_forks: 0
@@ -533,6 +544,7 @@
533544
owner_name: user2
534545
lower_name: git_hooks_test
535546
name: git_hooks_test
547+
is_empty: false
536548
is_private: false
537549
num_stars: 0
538550
num_forks: 0
@@ -546,6 +558,7 @@
546558
owner_name: limited_org
547559
lower_name: public_repo_on_limited_org
548560
name: public_repo_on_limited_org
561+
is_empty: false
549562
is_private: false
550563
num_stars: 0
551564
num_forks: 0
@@ -559,6 +572,7 @@
559572
owner_name: limited_org
560573
lower_name: private_repo_on_limited_org
561574
name: private_repo_on_limited_org
575+
is_empty: false
562576
is_private: true
563577
num_stars: 0
564578
num_forks: 0
@@ -572,6 +586,7 @@
572586
owner_name: privated_org
573587
lower_name: public_repo_on_private_org
574588
name: public_repo_on_private_org
589+
is_empty: false
575590
is_private: false
576591
num_stars: 0
577592
num_forks: 0
@@ -585,6 +600,7 @@
585600
owner_name: privated_org
586601
lower_name: private_repo_on_private_org
587602
name: private_repo_on_private_org
603+
is_empty: false
588604
is_private: true
589605
num_stars: 0
590606
num_forks: 0
@@ -597,6 +613,7 @@
597613
owner_name: user2
598614
lower_name: glob
599615
name: glob
616+
is_empty: false
600617
is_private: false
601618
num_stars: 0
602619
num_forks: 0
@@ -623,6 +640,7 @@
623640
owner_name: user27
624641
lower_name: template1
625642
name: template1
643+
is_empty: false
626644
is_private: false
627645
is_template: true
628646
num_stars: 0
@@ -651,6 +669,7 @@
651669
owner_name: org26
652670
lower_name: repo_external_tracker
653671
name: repo_external_tracker
672+
is_empty: false
654673
is_private: false
655674
num_stars: 0
656675
num_forks: 0
@@ -664,6 +683,7 @@
664683
owner_name: org26
665684
lower_name: repo_external_tracker_numeric
666685
name: repo_external_tracker_numeric
686+
is_empty: false
667687
is_private: false
668688
num_stars: 0
669689
num_forks: 0
@@ -677,6 +697,7 @@
677697
owner_name: org26
678698
lower_name: repo_external_tracker_alpha
679699
name: repo_external_tracker_alpha
700+
is_empty: false
680701
is_private: false
681702
num_stars: 0
682703
num_forks: 0
@@ -691,6 +712,7 @@
691712
owner_name: user27
692713
lower_name: repo49
693714
name: repo49
715+
is_empty: false
694716
is_private: false
695717
num_stars: 0
696718
num_forks: 0
@@ -737,3 +759,13 @@
737759
num_projects: 0
738760
num_closed_projects: 0
739761
status: 0
762+
763+
-
764+
id: 52
765+
owner_id: 30
766+
owner_name: user30
767+
lower_name: empty
768+
name: empty
769+
is_empty: true
770+
is_private: true
771+
status: 0

models/fixtures/user.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -523,7 +523,7 @@
523523
is_restricted: true
524524
avatar: avatar29
525525
avatar_email: user30@example.com
526-
num_repos: 2
526+
num_repos: 3
527527
is_active: true
528528
prohibit_login: true
529529

models/issue_xref.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,8 @@ func (issue *Issue) updateCrossReferenceList(list []*crossReference, xref *cross
195195

196196
// verifyReferencedIssue will check if the referenced issue exists, and whether the doer has permission to do what
197197
func (issue *Issue) verifyReferencedIssue(stdCtx context.Context, ctx *crossReferencesContext, repo *repo_model.Repository,
198-
ref references.IssueReference) (*Issue, references.XRefAction, error) {
198+
ref references.IssueReference,
199+
) (*Issue, references.XRefAction, error) {
199200
refIssue := &Issue{RepoID: repo.ID, Index: ref.Index}
200201
refAction := ref.Action
201202
e := db.GetEngine(stdCtx)

models/migrations/testlogger_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,11 @@ func (log *TestLogger) Init(config string) error {
166166
return nil
167167
}
168168

169+
// Content returns the content accumulated in the content provider
170+
func (log *TestLogger) Content() (string, error) {
171+
return "", fmt.Errorf("not supported")
172+
}
173+
169174
// Flush when log should be flushed
170175
func (log *TestLogger) Flush() {
171176
}

models/migrations/v210.go

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ import (
1111
"strings"
1212

1313
"code.gitea.io/gitea/modules/timeutil"
14-
"github.com/tstranex/u2f"
1514

15+
"github.com/tstranex/u2f"
1616
"xorm.io/xorm"
1717
"xorm.io/xorm/schemas"
1818
)
@@ -137,17 +137,23 @@ func remigrateU2FCredentials(x *xorm.Engine) error {
137137
CreatedUnix: reg.CreatedUnix,
138138
}
139139

140-
has, err := sess.ID(reg.ID).Where("id = ?", reg.ID).Get(new(webauthnCredential))
140+
has, err := sess.ID(reg.ID).Get(new(webauthnCredential))
141141
if err != nil {
142142
return fmt.Errorf("unable to get webauthn_credential[%d]. Error: %w", reg.ID, err)
143143
}
144144
if !has {
145-
_, err = sess.Insert(remigrated)
145+
has, err := sess.Where("`lower_name`=?", remigrated.LowerName).And("`user_id`=?", remigrated.UserID).Exist(new(webauthnCredential))
146146
if err != nil {
147-
return fmt.Errorf("unable to (re)insert webauthn_credential[%d]. Error: %w", reg.ID, err)
147+
return fmt.Errorf("unable to check webauthn_credential[lower_name: %s, user_id:%v]. Error: %w", remigrated.LowerName, remigrated.UserID, err)
148148
}
149+
if !has {
150+
_, err = sess.Insert(remigrated)
151+
if err != nil {
152+
return fmt.Errorf("unable to (re)insert webauthn_credential[%d]. Error: %w", reg.ID, err)
153+
}
149154

150-
continue
155+
continue
156+
}
151157
}
152158

153159
_, err = sess.ID(remigrated.ID).AllCols().Update(remigrated)

models/migrations/v210_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"testing"
99

1010
"code.gitea.io/gitea/modules/timeutil"
11+
1112
"github.com/stretchr/testify/assert"
1213
"xorm.io/xorm/schemas"
1314
)

0 commit comments

Comments
 (0)