Skip to content

Commit a99cb1f

Browse files
Merge branch 'master' into ssh-passthrough-docker
2 parents 80985ee + 7ac8a77 commit a99cb1f

File tree

28 files changed

+296
-219
lines changed

28 files changed

+296
-219
lines changed

CHANGELOG.md

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,17 @@ This changelog goes through all the changes that have been made in each release
44
without substantial changes to our git log; to see the highlights of what has
55
been added to each release, please refer to the [blog](https://blog.gitea.io).
66

7-
## [1.13.0-RC1](https://github.com/go-gitea/gitea/releases/tag/v1.13.0-rc1) - 2020-10-14
8-
7+
## [1.13.0](https://github.com/go-gitea/gitea/releases/tag/v1.13.0) - 2020-12-01
98
* SECURITY
9+
* Add Allow-/Block-List for Migrate & Mirrors (#13610) (#13776)
10+
* Prevent git operations for inactive users (#13527) (#13536)
11+
* Disallow urlencoded new lines in git protocol paths if there is a port (#13521) (#13524)
1012
* Mitigate Security vulnerability in the git hook feature (#13058)
1113
* Disable DSA ssh keys by default (#13056)
1214
* Set TLS minimum version to 1.2 (#12689)
1315
* Use argon as default password hash algorithm (#12688)
1416
* BREAKING
17+
* Set RUN_MODE prod by default (#13765) (#13767)
1518
* Don't replace underscores in auto-generated IDs in goldmark (#12805)
1619
* Add Primary Key to Topic and RepoTopic tables (#12639)
1720
* Disable password complexity check default (#12557)
@@ -71,6 +74,40 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
7174
* Add endpoint for Branch Creation (#11607)
7275
* Add pagination headers on endpoints that support total count from database (#11145)
7376
* BUGFIXES
77+
* Fix bogus http requests on diffs (#13760) (#13761)
78+
* Show 'owner' tag for real owner (#13689) (#13743)
79+
* Validate email before inserting/updating (#13475) (#13666)
80+
* Fix issue/pull request list assignee filter (#13647) (#13651)
81+
* Gitlab migration support for subdirectories (#13563) (#13591)
82+
* Fix logic for preferred license setting (#13550) (#13557)
83+
* Add missed sync branch/tag webhook (#13538) (#13556)
84+
* Migration won't fail on non-migrated reactions (#13507)
85+
* Fix Italian language file parsing error (#13156)
86+
* Show outdated comments in pull request (#13148) (#13162)
87+
* Fix parsing of pre-release git version (#13169) (#13172)
88+
* Fix diff skipping lines (#13154) (#13155)
89+
* When handling errors in storageHandler check underlying error (#13178) (#13193)
90+
* Fix size and clickable area on file table back link (#13205) (#13207)
91+
* Add better error checking for inline html diff code (#13251)
92+
* Fix initial commit page & binary munching problem (#13249) (#13258)
93+
* Fix migrations from remote Gitea instances when configuration not set (#13229) (#13273)
94+
* Store task errors following migrations and display them (#13246) (#13287)
95+
* Fix bug isEnd detection on getIssues/getPullRequests (#13299) (#13301)
96+
* When the git ref is unable to be found return broken pr (#13218) (#13303)
97+
* Ensure topics added using the API are added to the repository (#13285) (#13302)
98+
* Fix avatar autogeneration (#13233) (#13282)
99+
* Add migrated pulls to pull request task queue (#13331) (#13334)
100+
* Issue comment reactions should also check pull type on API (#13349) (#13350)
101+
* Fix links to repositories in /user/setting/repos (#13360) (#13362)
102+
* Remove obsolete change of email on profile page (#13341) (#13347)
103+
* Fix scrolling to resolved comment anchors (#13343) (#13371)
104+
* Storage configuration support `[storage]` (#13314) (#13379)
105+
* When creating line diffs do not split within an html entity (#13357) (#13375) (#13425) (#13427)
106+
* Fix reactions on code comments (#13390) (#13401)
107+
* Add missing full names when DEFAULT_SHOW_FULL_NAME is enabled (#13424)
108+
* Replies to outdated code comments should also be outdated (#13217) (#13433)
109+
* Fix panic bug in handling multiple references in commit (#13486) (#13487)
110+
* Prevent panic on git blame by limiting lines to 4096 bytes at most (#13470) (#13491)
74111
* Show original author's reviews on pull summary box (#13127)
75112
* Update golangci-lint to version 1.31.0 (#13102)
76113
* Fix line break for MS teams webhook (#13081)
@@ -140,6 +177,10 @@ been added to each release, please refer to the [blog](https://blog.gitea.io).
140177
* Fix Enter not working in SimpleMDE (#11564)
141178
* Fix bug about can't skip commits base on base branch (#11555)
142179
* ENHANCEMENTS
180+
* Only Return JSON for responses (#13511) (#13565)
181+
* Use existing analyzer module for language detection for highlighting (#13522) (#13551)
182+
* Return the full rejection message and errors in flash errors (#13221) (#13237)
183+
* Remove PAM from auth dropdown when unavailable (#13276) (#13281)
143184
* Add HostCertificate to sshd_config in Docker image (#13143)
144185
* Save TimeStamps for Star, Label, Follow, Watch and Collaboration to Database (#13124)
145186
* Improve error feedback for duplicate deploy keys (#13112)

docs/config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ params:
1818
description: Git with a cup of tea
1919
author: The Gitea Authors
2020
website: https://docs.gitea.io
21-
version: 1.12.6
21+
version: 1.13.0
2222
minGoVersion: 1.13
2323
goVersion: 1.15
2424
minNodeVersion: 10.13

integrations/git_helper_for_declarative_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ func onGiteaRun(t *testing.T, callback func(*testing.T, *url.URL), prepare ...bo
111111

112112
func doGitClone(dstLocalPath string, u *url.URL) func(*testing.T) {
113113
return func(t *testing.T) {
114-
assert.NoError(t, git.CloneWithArgs(u.String(), dstLocalPath, allowLFSFilters(), git.CloneRepoOptions{}))
114+
assert.NoError(t, git.CloneWithArgs(context.Background(), u.String(), dstLocalPath, allowLFSFilters(), git.CloneRepoOptions{}))
115115
assert.True(t, com.IsExist(filepath.Join(dstLocalPath, "README.md")))
116116
}
117117
}

models/migrations/migrations.go

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ type Version struct {
5757
// update minDBVersion accordingly
5858
var migrations = []Migration{
5959

60-
// Gitea 1.5.3 ends at v70
60+
// Gitea 1.5.0 ends at v69
6161

6262
// v70 -> v71
6363
NewMigration("add issue_dependencies", addIssueDependencies),
@@ -66,7 +66,7 @@ var migrations = []Migration{
6666
// v72 -> v73
6767
NewMigration("add review", addReview),
6868

69-
// Gitea 1.6.4 ends at v73
69+
// Gitea 1.6.0 ends at v73
7070

7171
// v73 -> v74
7272
NewMigration("add must_change_password column for users table", addMustChangePassword),
@@ -75,7 +75,7 @@ var migrations = []Migration{
7575
// v75 -> v76
7676
NewMigration("clear nonused data which not deleted when user was deleted", clearNonusedData),
7777

78-
// Gitea 1.7.6 ends at v76
78+
// Gitea 1.7.0 ends at v76
7979

8080
// v76 -> v77
8181
NewMigration("add pull request rebase with merge commit", addPullRequestRebaseWithMerge),
@@ -90,7 +90,7 @@ var migrations = []Migration{
9090
// v81 -> v82
9191
NewMigration("update U2F counter type", changeU2FCounterType),
9292

93-
// Gitea 1.8.3 ends at v82
93+
// Gitea 1.8.0 ends at v82
9494

9595
// v82 -> v83
9696
NewMigration("hot fix for wrong release sha1 on release table", fixReleaseSha1OnReleaseTable),
@@ -105,7 +105,7 @@ var migrations = []Migration{
105105
// v87 -> v88
106106
NewMigration("add avatar field to repository", addAvatarFieldToRepository),
107107

108-
// Gitea 1.9.6 ends at v88
108+
// Gitea 1.9.0 ends at v88
109109

110110
// v88 -> v89
111111
NewMigration("add commit status context field to commit_status", addCommitStatusContext),
@@ -129,14 +129,14 @@ var migrations = []Migration{
129129
NewMigration("add repo_admin_change_team_access to user", addRepoAdminChangeTeamAccessColumnForUser),
130130
// v98 -> v99
131131
NewMigration("add original author name and id on migrated release", addOriginalAuthorOnMigratedReleases),
132-
133-
// Gitea 1.10.3 ends at v99
134-
135132
// v99 -> v100
136133
NewMigration("add task table and status column for repository table", addTaskTable),
137134
// v100 -> v101
138135
NewMigration("update migration repositories' service type", updateMigrationServiceTypes),
139136
// v101 -> v102
137+
138+
// Gitea 1.10.0 ends at v102
139+
140140
NewMigration("change length of some external login users columns", changeSomeColumnsLengthOfExternalLoginUser),
141141
// v102 -> v103
142142
NewMigration("update migration repositories' service type", dropColumnHeadUserNameOnPullRequest),
@@ -167,6 +167,9 @@ var migrations = []Migration{
167167
// v115 -> v116
168168
NewMigration("add user_id prefix to existing user avatar name", renameExistingUserAvatarName),
169169
// v116 -> v117
170+
171+
// Gitea 1.11.0 ends at v117
172+
170173
NewMigration("Extend TrackedTimes", extendTrackedTimes),
171174
// v117 -> v118
172175
NewMigration("Add block on rejected reviews branch protection", addBlockOnRejectedReviews),
@@ -213,6 +216,9 @@ var migrations = []Migration{
213216
// v138 -> v139
214217
NewMigration("Add ResolveDoerID to Comment table", addResolveDoerIDCommentColumn),
215218
// v139 -> v140
219+
220+
// Gitea 1.12.0 ends at v140
221+
216222
NewMigration("prepend refs/heads/ to issue refs", prependRefsHeadsToIssueRefs),
217223
// v140 -> v141
218224
NewMigration("Save detected language file size to database instead of percent", fixLanguageStatsToSaveSize),
@@ -243,6 +249,9 @@ var migrations = []Migration{
243249
// v153 > v154
244250
NewMigration("add Team review request support", addTeamReviewRequestSupport),
245251
// v154 > v155
252+
253+
// Gitea 1.13.0 ends at v155
254+
246255
NewMigration("add timestamps to Star, Label, Follow, Watch and Collaboration", addTimeStamps),
247256
// v155 -> v156
248257
NewMigration("add changed_protected_files column for pull_request table", addChangedProtectedFilesPullRequestColumn),

models/repo.go

Lines changed: 0 additions & 134 deletions
Original file line numberDiff line numberDiff line change
@@ -322,11 +322,6 @@ func (repo *Repository) APIURL() string {
322322
return setting.AppURL + path.Join("api/v1/repos", repo.FullName())
323323
}
324324

325-
// APIFormat converts a Repository to api.Repository
326-
func (repo *Repository) APIFormat(mode AccessMode) *api.Repository {
327-
return repo.innerAPIFormat(x, mode, false)
328-
}
329-
330325
// GetCommitsCountCacheKey returns cache key used for commits count caching.
331326
func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool) string {
332327
var prefix string
@@ -338,135 +333,6 @@ func (repo *Repository) GetCommitsCountCacheKey(contextName string, isRef bool)
338333
return fmt.Sprintf("commits-count-%d-%s-%s", repo.ID, prefix, contextName)
339334
}
340335

341-
func (repo *Repository) innerAPIFormat(e Engine, mode AccessMode, isParent bool) *api.Repository {
342-
var parent *api.Repository
343-
344-
cloneLink := repo.cloneLink(false)
345-
permission := &api.Permission{
346-
Admin: mode >= AccessModeAdmin,
347-
Push: mode >= AccessModeWrite,
348-
Pull: mode >= AccessModeRead,
349-
}
350-
if !isParent {
351-
err := repo.getBaseRepo(e)
352-
if err != nil {
353-
log.Error("APIFormat: %v", err)
354-
}
355-
if repo.BaseRepo != nil {
356-
parent = repo.BaseRepo.innerAPIFormat(e, mode, true)
357-
}
358-
}
359-
360-
//check enabled/disabled units
361-
hasIssues := false
362-
var externalTracker *api.ExternalTracker
363-
var internalTracker *api.InternalTracker
364-
if unit, err := repo.getUnit(e, UnitTypeIssues); err == nil {
365-
config := unit.IssuesConfig()
366-
hasIssues = true
367-
internalTracker = &api.InternalTracker{
368-
EnableTimeTracker: config.EnableTimetracker,
369-
AllowOnlyContributorsToTrackTime: config.AllowOnlyContributorsToTrackTime,
370-
EnableIssueDependencies: config.EnableDependencies,
371-
}
372-
} else if unit, err := repo.getUnit(e, UnitTypeExternalTracker); err == nil {
373-
config := unit.ExternalTrackerConfig()
374-
hasIssues = true
375-
externalTracker = &api.ExternalTracker{
376-
ExternalTrackerURL: config.ExternalTrackerURL,
377-
ExternalTrackerFormat: config.ExternalTrackerFormat,
378-
ExternalTrackerStyle: config.ExternalTrackerStyle,
379-
}
380-
}
381-
hasUncyclo := false
382-
var externalUncyclo *api.ExternalUncyclo
383-
if _, err := repo.getUnit(e, UnitTypeUncyclo); err == nil {
384-
hasUncyclo = true
385-
} else if unit, err := repo.getUnit(e, UnitTypeExternalUncyclo); err == nil {
386-
hasUncyclo = true
387-
config := unit.ExternalUncycloConfig()
388-
externalUncyclo = &api.ExternalUncyclo{
389-
ExternalUncycloURL: config.ExternalUncycloURL,
390-
}
391-
}
392-
hasPullRequests := false
393-
ignoreWhitespaceConflicts := false
394-
allowMerge := false
395-
allowRebase := false
396-
allowRebaseMerge := false
397-
allowSquash := false
398-
if unit, err := repo.getUnit(e, UnitTypePullRequests); err == nil {
399-
config := unit.PullRequestsConfig()
400-
hasPullRequests = true
401-
ignoreWhitespaceConflicts = config.IgnoreWhitespaceConflicts
402-
allowMerge = config.AllowMerge
403-
allowRebase = config.AllowRebase
404-
allowRebaseMerge = config.AllowRebaseMerge
405-
allowSquash = config.AllowSquash
406-
}
407-
hasProjects := false
408-
if _, err := repo.getUnit(e, UnitTypeProjects); err == nil {
409-
hasProjects = true
410-
}
411-
412-
repo.mustOwner(e)
413-
414-
numReleases, _ := GetReleaseCountByRepoID(repo.ID, FindReleasesOptions{IncludeDrafts: false, IncludeTags: true})
415-
416-
return &api.Repository{
417-
ID: repo.ID,
418-
// TODO use convert.ToUser(repo.Owner)
419-
Owner: &api.User{
420-
ID: repo.Owner.ID,
421-
UserName: repo.Owner.Name,
422-
FullName: repo.Owner.FullName,
423-
Email: repo.Owner.GetEmail(),
424-
AvatarURL: repo.Owner.AvatarLink(),
425-
LastLogin: repo.Owner.LastLoginUnix.AsTime(),
426-
Created: repo.Owner.CreatedUnix.AsTime(),
427-
},
428-
Name: repo.Name,
429-
FullName: repo.FullName(),
430-
Description: repo.Description,
431-
Private: repo.IsPrivate,
432-
Template: repo.IsTemplate,
433-
Empty: repo.IsEmpty,
434-
Archived: repo.IsArchived,
435-
Size: int(repo.Size / 1024),
436-
Fork: repo.IsFork,
437-
Parent: parent,
438-
Mirror: repo.IsMirror,
439-
HTMLURL: repo.HTMLURL(),
440-
SSHURL: cloneLink.SSH,
441-
CloneURL: cloneLink.HTTPS,
442-
Website: repo.Website,
443-
Stars: repo.NumStars,
444-
Forks: repo.NumForks,
445-
Watchers: repo.NumWatches,
446-
OpenIssues: repo.NumOpenIssues,
447-
OpenPulls: repo.NumOpenPulls,
448-
Releases: int(numReleases),
449-
DefaultBranch: repo.DefaultBranch,
450-
Created: repo.CreatedUnix.AsTime(),
451-
Updated: repo.UpdatedUnix.AsTime(),
452-
Permissions: permission,
453-
HasIssues: hasIssues,
454-
ExternalTracker: externalTracker,
455-
InternalTracker: internalTracker,
456-
HasUncyclo: hasUncyclo,
457-
HasProjects: hasProjects,
458-
ExternalUncyclo: externalUncyclo,
459-
HasPullRequests: hasPullRequests,
460-
IgnoreWhitespaceConflicts: ignoreWhitespaceConflicts,
461-
AllowMerge: allowMerge,
462-
AllowRebase: allowRebase,
463-
AllowRebaseMerge: allowRebaseMerge,
464-
AllowSquash: allowSquash,
465-
AvatarURL: repo.avatarLink(e),
466-
Internal: !repo.IsPrivate && repo.Owner.Visibility == api.VisibleTypePrivate,
467-
}
468-
}
469-
470336
func (repo *Repository) getUnits(e Engine) (err error) {
471337
if repo.Units != nil {
472338
return nil

modules/convert/notification.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func ToNotificationThread(n *models.Notification) *api.NotificationThread {
2121

2222
//since user only get notifications when he has access to use minimal access mode
2323
if n.Repository != nil {
24-
result.Repository = n.Repository.APIFormat(models.AccessModeRead)
24+
result.Repository = ToRepo(n.Repository, models.AccessModeRead)
2525
}
2626

2727
//handle Subject

modules/convert/pull.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ func ToAPIPullRequest(pr *models.PullRequest) *api.PullRequest {
6868
Name: pr.BaseBranch,
6969
Ref: pr.BaseBranch,
7070
RepoID: pr.BaseRepoID,
71-
Repository: pr.BaseRepo.APIFormat(models.AccessModeNone),
71+
Repository: ToRepo(pr.BaseRepo, models.AccessModeNone),
7272
},
7373
Head: &api.PRBranchInfo{
7474
Name: pr.HeadBranch,
@@ -97,7 +97,7 @@ func ToAPIPullRequest(pr *models.PullRequest) *api.PullRequest {
9797

9898
if pr.HeadRepo != nil {
9999
apiPullRequest.Head.RepoID = pr.HeadRepo.ID
100-
apiPullRequest.Head.Repository = pr.HeadRepo.APIFormat(models.AccessModeNone)
100+
apiPullRequest.Head.Repository = ToRepo(pr.HeadRepo, models.AccessModeNone)
101101

102102
headGitRepo, err := git.OpenRepository(pr.HeadRepo.RepoPath())
103103
if err != nil {

modules/convert/pull_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestPullRequest_APIFormat(t *testing.T) {
2727
Ref: "refs/pull/2/head",
2828
Sha: "4a357436d925b5c974181ff12a994538ddc5a269",
2929
RepoID: 1,
30-
Repository: headRepo.APIFormat(models.AccessModeNone),
30+
Repository: ToRepo(headRepo, models.AccessModeNone),
3131
}, apiPullRequest.Head)
3232

3333
//withOut HeadRepo

0 commit comments

Comments
 (0)