From c403e2f1cfe3aa248cf8139b5d552a5fc22902d2 Mon Sep 17 00:00:00 2001 From: MisterCavespider Date: Wed, 21 Dec 2022 13:19:04 +0100 Subject: [PATCH 01/17] Fixed colour transparency regex matching in project board sorting (#22091) (#22092) As described in the linked issue (#22091), semi-transparent UI elements would result in JS errors due to the fact that the CSS `backgroundColor` element was being matched by the pattern `^rgb\((\d+),\s*(\d+),\s*(\d+)\)$`, which does not take the alpha channel into account. I changed the pattern to `^rgba?\((\d+),\s*(\d+),\s*(\d+).*\)$`. This new pattern accepts both `rgb` and `rgba` tuples, and ignores the alpha channel (that little `.*` at the end) from the sorting criteria. The reason why I chose to ignore alpha is because when it comes to kanban colour sorting, only the hue is important; the order of the panels should stay the same, even if some of them are transparent. Alternative solutions were discussed in the bug report and are included here for completeness: 1. Change the regex from ^rgb\((\d+),\s*(\d+),\s*(\d+)\)$ to ^rgba?\((\d+),\s*(\d+),\s*(\d+)(,\s*(\d+(\.\d+)?))?\)$ (alpha channel is a float or NaN on 5th group) and include the alpha channel in the sorting criteria. 2. Rethink on why you're reading colours out of the CSS in the first place, then reformat this sorting procedure. Co-authored-by: Lauris BH Co-authored-by: Lunny Xiao Co-authored-by: techknowlogick --- web_src/js/features/repo-projects.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index 78a9b14ad0..b5a720c9d7 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -204,7 +204,7 @@ function getRelativeColor(color) { } function rgbToHex(rgb) { - rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/); + rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+).*\)$/); return `#${hex(rgb[1])}${hex(rgb[2])}${hex(rgb[3])}`; } From 9914b21493784793fb4a3660369befb98a9bd073 Mon Sep 17 00:00:00 2001 From: John Olheiser Date: Wed, 21 Dec 2022 13:45:32 -0600 Subject: [PATCH 02/17] fix: update libcurl in docs pipeline (#22203) updating libcurl fixes the mismatch between curl and libcurl Signed-off-by: jolheiser Co-authored-by: silverwind --- .drone.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.drone.yml b/.drone.yml index 4fa420105a..48ba3e8f97 100644 --- a/.drone.yml +++ b/.drone.yml @@ -931,7 +931,8 @@ steps: image: plugins/hugo:latest pull: always commands: - - apk add --no-cache make bash curl + # https://github.com/drone-plugins/drone-hugo/issues/36 + - apk upgrade --no-cache libcurl && apk add --no-cache make bash curl - cd docs - make trans-copy clean build From 48d71b7d6b0ddefdc1db76d5b5f3b3eabc4ae9e4 Mon Sep 17 00:00:00 2001 From: Reo <112817228+reopt999@users.noreply.github.com> Date: Thu, 22 Dec 2022 04:06:26 +0700 Subject: [PATCH 03/17] Add Feed for Releases and Tags (#21696) Fixes #19091 Add Feed for Releases and Tags, can be accessed through `reponame/releases.rss`, `reponame/releases.atom`, `reponame/tags.rss`, and `reponame/tags.atom` Signed-off-by: Reo --- options/locale/locale_en-US.ini | 2 ++ routers/web/feed/convert.go | 44 ++++++++++++++++++++++++++++ routers/web/feed/release.go | 50 ++++++++++++++++++++++++++++++++ routers/web/repo/release.go | 25 ++++++++++++++++ routers/web/web.go | 13 +++++++-- templates/repo/release/list.tmpl | 3 ++ 6 files changed, 135 insertions(+), 2 deletions(-) create mode 100644 routers/web/feed/release.go diff --git a/options/locale/locale_en-US.ini b/options/locale/locale_en-US.ini index dd31562c3a..62471abe6f 100644 --- a/options/locale/locale_en-US.ini +++ b/options/locale/locale_en-US.ini @@ -2279,6 +2279,8 @@ release.downloads = Downloads release.download_count = Downloads: %s release.add_tag_msg = Use the title and content of release as tag message. release.add_tag = Create Tag Only +release.releases_for = Releases for %s +release.tags_for = Tags for %s branch.name = Branch Name branch.search = Search branches diff --git a/routers/web/feed/convert.go b/routers/web/feed/convert.go index 7d472a7f87..7c375a085f 100644 --- a/routers/web/feed/convert.go +++ b/routers/web/feed/convert.go @@ -12,6 +12,7 @@ import ( "strings" activities_model "code.gitea.io/gitea/models/activities" + repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/modules/context" "code.gitea.io/gitea/modules/markup" "code.gitea.io/gitea/modules/markup/markdown" @@ -268,3 +269,46 @@ func GetFeedType(name string, req *http.Request) (bool, string, string) { return false, name, "" } + +// feedActionsToFeedItems convert gitea's Repo's Releases to feeds Item +func releasesToFeedItems(ctx *context.Context, releases []*repo_model.Release, isReleasesOnly bool) (items []*feeds.Item, err error) { + for _, rel := range releases { + err := rel.LoadAttributes(ctx) + if err != nil { + return nil, err + } + + var title, content string + + if rel.IsTag { + title = rel.TagName + } else { + title = rel.Title + } + + link := &feeds.Link{Href: rel.HTMLURL()} + content, err = markdown.RenderString(&markup.RenderContext{ + Ctx: ctx, + URLPrefix: rel.Repo.Link(), + Metas: rel.Repo.ComposeMetas(), + }, rel.Note) + + if err != nil { + return nil, err + } + + items = append(items, &feeds.Item{ + Title: title, + Link: link, + Created: rel.CreatedUnix.AsTime(), + Author: &feeds.Author{ + Name: rel.Publisher.DisplayName(), + Email: rel.Publisher.GetEmail(), + }, + Id: fmt.Sprintf("%v: %v", strconv.FormatInt(rel.ID, 10), link.Href), + Content: content, + }) + } + + return items, err +} diff --git a/routers/web/feed/release.go b/routers/web/feed/release.go new file mode 100644 index 0000000000..fbfa11c63e --- /dev/null +++ b/routers/web/feed/release.go @@ -0,0 +1,50 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package feed + +import ( + "time" + + repo_model "code.gitea.io/gitea/models/repo" + "code.gitea.io/gitea/modules/context" + + "github.com/gorilla/feeds" +) + +// shows tags and/or releases on the repo as RSS / Atom feed +func ShowReleaseFeed(ctx *context.Context, repo *repo_model.Repository, isReleasesOnly bool, formatType string) { + releases, err := repo_model.GetReleasesByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{ + IncludeTags: !isReleasesOnly, + }) + if err != nil { + ctx.ServerError("GetReleasesByRepoID", err) + return + } + + var title string + var link *feeds.Link + + if isReleasesOnly { + title = ctx.Tr("repo.release.releases_for", repo.FullName()) + link = &feeds.Link{Href: repo.HTMLURL() + "/release"} + } else { + title = ctx.Tr("repo.release.tags_for", repo.FullName()) + link = &feeds.Link{Href: repo.HTMLURL() + "/tags"} + } + + feed := &feeds.Feed{ + Title: title, + Link: link, + Description: repo.Description, + Created: time.Now(), + } + + feed.Items, err = releasesToFeedItems(ctx, releases, isReleasesOnly) + if err != nil { + ctx.ServerError("releasesToFeedItems", err) + return + } + + writeFeed(ctx, feed, formatType) +} diff --git a/routers/web/repo/release.go b/routers/web/repo/release.go index 2047a1cfb9..54f503642b 100644 --- a/routers/web/repo/release.go +++ b/routers/web/repo/release.go @@ -23,6 +23,7 @@ import ( "code.gitea.io/gitea/modules/upload" "code.gitea.io/gitea/modules/util" "code.gitea.io/gitea/modules/web" + "code.gitea.io/gitea/routers/web/feed" "code.gitea.io/gitea/services/forms" releaseservice "code.gitea.io/gitea/services/release" ) @@ -199,6 +200,30 @@ func releasesOrTags(ctx *context.Context, isTagList bool) { ctx.HTML(http.StatusOK, tplReleases) } +// ReleasesFeedRSS get feeds for releases in RSS format +func ReleasesFeedRSS(ctx *context.Context) { + releasesOrTagsFeed(ctx, true, "rss") +} + +// TagsListFeedRSS get feeds for tags in RSS format +func TagsListFeedRSS(ctx *context.Context) { + releasesOrTagsFeed(ctx, false, "rss") +} + +// ReleasesFeedAtom get feeds for releases in Atom format +func ReleasesFeedAtom(ctx *context.Context) { + releasesOrTagsFeed(ctx, true, "atom") +} + +// TagsListFeedAtom get feeds for tags in RSS format +func TagsListFeedAtom(ctx *context.Context) { + releasesOrTagsFeed(ctx, false, "atom") +} + +func releasesOrTagsFeed(ctx *context.Context, isReleasesOnly bool, formatType string) { + feed.ShowReleaseFeed(ctx, ctx.Repo.Repository, isReleasesOnly, formatType) +} + // SingleRelease renders a single release's page func SingleRelease(ctx *context.Context) { ctx.Data["Title"] = ctx.Tr("repo.release.releases") diff --git a/routers/web/web.go b/routers/web/web.go index 20d067a163..31b3eb9baa 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1087,12 +1087,21 @@ func RegisterRoutes(m *web.Route) { // Releases m.Group("/{username}/{reponame}", func() { - m.Get("/tags", repo.TagsList, repo.MustBeNotEmpty, - reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag)) + m.Group("/tags", func() { + m.Get("", repo.TagsList) + m.Get(".rss", feedEnabled, repo.TagsListFeedRSS) + m.Get(".atom", feedEnabled, repo.TagsListFeedAtom) + }, func(ctx *context.Context) { + ctx.Data["EnableFeed"] = setting.EnableFeed + }, repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true)) m.Group("/releases", func() { m.Get("/", repo.Releases) m.Get("/tag/*", repo.SingleRelease) m.Get("/latest", repo.LatestRelease) + m.Get(".rss", feedEnabled, repo.ReleasesFeedRSS) + m.Get(".atom", feedEnabled, repo.ReleasesFeedAtom) + }, func(ctx *context.Context) { + ctx.Data["EnableFeed"] = setting.EnableFeed }, repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true)) m.Get("/releases/attachments/{uuid}", repo.GetAttachment, repo.MustBeNotEmpty, reqRepoReleaseReader) m.Group("/releases", func() { diff --git a/templates/repo/release/list.tmpl b/templates/repo/release/list.tmpl index f8c54bf7f6..9f4104bec5 100644 --- a/templates/repo/release/list.tmpl +++ b/templates/repo/release/list.tmpl @@ -11,6 +11,9 @@ {{.locale.Tr "repo.release.tags"}} {{end}} + {{if .EnableFeed}} + {{svg "octicon-rss" 18}} + {{end}} {{if (and .CanCreateRelease (not .PageIsTagList))}} {{.locale.Tr "repo.release.new_release"}} From b76718249ab39b4d6502e373c09b50989389157a Mon Sep 17 00:00:00 2001 From: KN4CK3R Date: Wed, 21 Dec 2022 23:45:44 +0100 Subject: [PATCH 04/17] Allow empty assignees on pull request edit (#22150) Fixes #22140 --- routers/api/v1/repo/pull.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/routers/api/v1/repo/pull.go b/routers/api/v1/repo/pull.go index 1246ede9e6..ed23b267f2 100644 --- a/routers/api/v1/repo/pull.go +++ b/routers/api/v1/repo/pull.go @@ -490,6 +490,11 @@ func EditPullRequest(ctx *context.APIContext) { issue := pr.Issue issue.Repo = ctx.Repo.Repository + if err := issue.LoadAttributes(ctx); err != nil { + ctx.Error(http.StatusInternalServerError, "LoadAttributes", err) + return + } + if !issue.IsPoster(ctx.Doer.ID) && !ctx.Repo.CanWrite(unit.TypePullRequests) { ctx.Status(http.StatusForbidden) return From 8e17fb5c066bf80c6d9b9d520c217fb1ccfe96df Mon Sep 17 00:00:00 2001 From: zeripath Date: Thu, 22 Dec 2022 01:08:26 +0000 Subject: [PATCH 05/17] Update bleve and zapx to fix unaligned atomic (#22031) There is an unaligned atomic field in zapx 15.3.5 which should have been fixed in a subsequent patch This bug causes issues on 32bit builds. Update bleve and zapx to account for this. Fix #21957 Signed-off-by: Andrew Thornton --- go.mod | 22 ++++++++++++---------- go.sum | 45 ++++++++++++++++++++------------------------- 2 files changed, 32 insertions(+), 35 deletions(-) diff --git a/go.mod b/go.mod index cf3d71fa51..2c53867e1e 100644 --- a/go.mod +++ b/go.mod @@ -16,7 +16,7 @@ require ( github.com/NYTimes/gziphandler v1.1.1 github.com/PuerkitoBio/goquery v1.8.0 github.com/alecthomas/chroma/v2 v2.4.0 - github.com/blevesearch/bleve/v2 v2.3.4 + github.com/blevesearch/bleve/v2 v2.3.5 github.com/buildkite/terminal-to-html/v3 v3.7.0 github.com/caddyserver/certmagic v0.17.2 github.com/chi-middleware/proxy v1.1.1 @@ -129,21 +129,21 @@ require ( github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/bits-and-blooms/bitset v1.3.3 // indirect - github.com/blevesearch/bleve_index_api v1.0.3 // indirect - github.com/blevesearch/geo v0.1.14 // indirect + github.com/blevesearch/bleve_index_api v1.0.4 // indirect + github.com/blevesearch/geo v0.1.15 // indirect github.com/blevesearch/go-porterstemmer v1.0.3 // indirect github.com/blevesearch/gtreap v0.1.1 // indirect github.com/blevesearch/mmap-go v1.0.4 // indirect - github.com/blevesearch/scorch_segment_api/v2 v2.1.2 // indirect + github.com/blevesearch/scorch_segment_api/v2 v2.1.3 // indirect github.com/blevesearch/segment v0.9.0 // indirect github.com/blevesearch/snowballstem v0.9.0 // indirect github.com/blevesearch/upsidedown_store_api v1.0.1 // indirect - github.com/blevesearch/vellum v1.0.8 // indirect - github.com/blevesearch/zapx/v11 v11.3.5 // indirect - github.com/blevesearch/zapx/v12 v12.3.5 // indirect - github.com/blevesearch/zapx/v13 v13.3.5 // indirect - github.com/blevesearch/zapx/v14 v14.3.5 // indirect - github.com/blevesearch/zapx/v15 v15.3.5 // indirect + github.com/blevesearch/vellum v1.0.9 // indirect + github.com/blevesearch/zapx/v11 v11.3.6 // indirect + github.com/blevesearch/zapx/v12 v12.3.6 // indirect + github.com/blevesearch/zapx/v13 v13.3.6 // indirect + github.com/blevesearch/zapx/v14 v14.3.6 // indirect + github.com/blevesearch/zapx/v15 v15.3.6 // indirect github.com/boombuler/barcode v1.0.1 // indirect github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect @@ -305,6 +305,8 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142 replace github.com/satori/go.uuid v1.2.0 => github.com/gofrs/uuid v4.2.0+incompatible +replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix + exclude github.com/gofrs/uuid v3.2.0+incompatible exclude github.com/gofrs/uuid v4.0.0+incompatible diff --git a/go.sum b/go.sum index 4ef817eaa2..6388c2b183 100644 --- a/go.sum +++ b/go.sum @@ -149,7 +149,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= github.com/RoaringBitmap/roaring v0.7.1/go.mod h1:jdT9ykXwHFNdJbEtxePexlFYH9LXucApeS0/+/g+p1I= -github.com/RoaringBitmap/roaring v0.9.4/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= github.com/RoaringBitmap/roaring v1.2.1 h1:58/LJlg/81wfEHd5L9qsHduznOIhyv4qb1yWcSvVq9A= github.com/RoaringBitmap/roaring v1.2.1/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= @@ -226,52 +225,47 @@ github.com/bits-and-blooms/bitset v1.3.3/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edY github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84= github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI= github.com/blevesearch/bleve/v2 v2.0.5/go.mod h1:ZjWibgnbRX33c+vBRgla9QhPb4QOjD6fdVJ+R1Bk8LM= -github.com/blevesearch/bleve/v2 v2.3.4 h1:SSb7/cwGzo85LWX1jchIsXM8ZiNNMX3shT5lROM63ew= -github.com/blevesearch/bleve/v2 v2.3.4/go.mod h1:Ot0zYum8XQRfPcwhae8bZmNyYubynsoMjVvl1jPqL30= +github.com/blevesearch/bleve/v2 v2.3.5 h1:1wuR7eB8Fk9UaCaBUfnQt5V7zIpi4VDok9ExN7Rl+/8= +github.com/blevesearch/bleve/v2 v2.3.5/go.mod h1:FneKGHMRrCLrp4X9+iy3wlBqgM2ALucg7bp8jUuAi/s= github.com/blevesearch/bleve_index_api v1.0.0/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4= -github.com/blevesearch/bleve_index_api v1.0.3 h1:DDSWaPXOZZJ2BB73ZTWjKxydAugjwywcqU+91AAqcAg= github.com/blevesearch/bleve_index_api v1.0.3/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4= -github.com/blevesearch/geo v0.1.13/go.mod h1:cRIvqCdk3cgMhGeHNNe6yPzb+w56otxbfo1FBJfR2Pc= -github.com/blevesearch/geo v0.1.14 h1:TTDpJN6l9ck/cUYbXSn4aCElNls0Whe44rcQKsB7EfU= -github.com/blevesearch/geo v0.1.14/go.mod h1:cRIvqCdk3cgMhGeHNNe6yPzb+w56otxbfo1FBJfR2Pc= -github.com/blevesearch/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:9eJDeqxJ3E7WnLebQUlPD7ZjSce7AnDb9vjGmMCbD0A= +github.com/blevesearch/bleve_index_api v1.0.4 h1:mtlzsyJjMIlDngqqB1mq8kPryUMIuEVVbRbJHOWEexU= +github.com/blevesearch/bleve_index_api v1.0.4/go.mod h1:YXMDwaXFFXwncRS8UobWs7nvo0DmusriM1nztTlj1ms= +github.com/blevesearch/geo v0.1.15 h1:0NybEduqE5fduFRYiUKF0uqybAIFKXYjkBdXKYn7oA4= +github.com/blevesearch/geo v0.1.15/go.mod h1:cRIvqCdk3cgMhGeHNNe6yPzb+w56otxbfo1FBJfR2Pc= github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo= github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M= -github.com/blevesearch/goleveldb v1.0.1/go.mod h1:WrU8ltZbIp0wAoig/MHbrPCXSOLpe79nz5lv5nqfYrQ= github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y= github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgYICSZ3w0tYk= github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA= github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc= github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs= github.com/blevesearch/scorch_segment_api/v2 v2.0.1/go.mod h1:lq7yK2jQy1yQjtjTfU931aVqz7pYxEudHaDwOt1tXfU= -github.com/blevesearch/scorch_segment_api/v2 v2.1.2 h1:TAte9VZLWda5WAVlZTTZ+GCzEHqGJb4iB2aiZSA6Iv8= -github.com/blevesearch/scorch_segment_api/v2 v2.1.2/go.mod h1:rvoQXZGq8drq7vXbNeyiRzdEOwZkjkiYGf1822i6CRA= +github.com/blevesearch/scorch_segment_api/v2 v2.1.3 h1:2UzpR2dR5DvSZk8tVJkcQ7D5xhoK/UBelYw8ttBHrRQ= +github.com/blevesearch/scorch_segment_api/v2 v2.1.3/go.mod h1:eZrfp1y+lUh+DzFjUcTBUSnKGuunyFIpBIvqYVzJfvc= github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac= github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ= -github.com/blevesearch/snowball v0.6.1/go.mod h1:ZF0IBg5vgpeoUhnMza2v0A/z8m1cWPlwhke08LpNusg= github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s= github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs= github.com/blevesearch/upsidedown_store_api v1.0.1 h1:1SYRwyoFLwG3sj0ed89RLtM15amfX2pXlYbFOnF8zNU= github.com/blevesearch/upsidedown_store_api v1.0.1/go.mod h1:MQDVGpHZrpe3Uy26zJBf/a8h0FZY6xJbthIMm8myH2Q= github.com/blevesearch/vellum v1.0.3/go.mod h1:2u5ax02KeDuNWu4/C+hVQMD6uLN4txH1JbtpaDNLJRo= github.com/blevesearch/vellum v1.0.4/go.mod h1:cMhywHI0de50f7Nj42YgvyD6bFJ2WkNRvNBlNMrEVgY= -github.com/blevesearch/vellum v1.0.8 h1:iMGh4lfxza4BnWO/UJTMPlI3HsK9YawjPv+TteVa9ck= -github.com/blevesearch/vellum v1.0.8/go.mod h1:+cpRi/tqq49xUYSQN2P7A5zNSNrS+MscLeeaZ3J46UA= +github.com/blevesearch/vellum v1.0.9 h1:PL+NWVk3dDGPCV0hoDu9XLLJgqU4E5s/dOeEJByQ2uQ= +github.com/blevesearch/vellum v1.0.9/go.mod h1:ul1oT0FhSMDIExNjIxHqJoGpVrBpKCdgDQNxfqgJt7k= github.com/blevesearch/zapx/v11 v11.2.0/go.mod h1:gN/a0alGw1FZt/YGTo1G6Z6XpDkeOfujX5exY9sCQQM= -github.com/blevesearch/zapx/v11 v11.3.5 h1:eBQWQ7huA+mzm0sAGnZDwgGGli7S45EO+N+ObFWssbI= -github.com/blevesearch/zapx/v11 v11.3.5/go.mod h1:5UdIa/HRMdeRCiLQOyFESsnqBGiip7vQmYReA9toevU= +github.com/blevesearch/zapx/v11 v11.3.6 h1:50jET4HUJ6eCqGxdhUt+mjybMvEX2MWyqLGtCx3yUgc= +github.com/blevesearch/zapx/v11 v11.3.6/go.mod h1:B0CzJRj/pS7hJIroflRtFsa9mRHpMSucSgre0FVINns= github.com/blevesearch/zapx/v12 v12.2.0/go.mod h1:fdjwvCwWWwJW/EYTYGtAp3gBA0geCYGLcVTtJEZnY6A= -github.com/blevesearch/zapx/v12 v12.3.5 h1:5pX2hU+R1aZihT7ac1dNWh1n4wqkIM9pZzWp0ANED9s= -github.com/blevesearch/zapx/v12 v12.3.5/go.mod h1:ANcthYRZQycpbRut/6ArF5gP5HxQyJqiFcuJCBju/ss= +github.com/blevesearch/zapx/v12 v12.3.6 h1:G304NHBLgQeZ+IHK/XRCM0nhHqAts8MEvHI6LhoDNM4= +github.com/blevesearch/zapx/v12 v12.3.6/go.mod h1:iYi7tIKpauwU5os5wTxJITixr5Km21Hl365otMwdaP0= github.com/blevesearch/zapx/v13 v13.2.0/go.mod h1:o5rAy/lRS5JpAbITdrOHBS/TugWYbkcYZTz6VfEinAQ= -github.com/blevesearch/zapx/v13 v13.3.5 h1:eJ3gbD+Nu8p36/O6lhfdvWQ4pxsGYSuTOBrLLPVWJ74= -github.com/blevesearch/zapx/v13 v13.3.5/go.mod h1:FV+dRnScFgKnRDIp08RQL4JhVXt1x2HE3AOzqYa6fjo= +github.com/blevesearch/zapx/v13 v13.3.6 h1:vavltQHNdjQezhLZs5nIakf+w/uOa1oqZxB58Jy/3Ig= +github.com/blevesearch/zapx/v13 v13.3.6/go.mod h1:X+FsTwCU8qOHtK0d/ArvbOH7qiIgViSQ1GQvcR6LSkI= github.com/blevesearch/zapx/v14 v14.2.0/go.mod h1:GNgZusc1p4ot040cBQMRGEZobvwjCquiEKYh1xLFK9g= -github.com/blevesearch/zapx/v14 v14.3.5 h1:hEvVjZaagFCvOUJrlFQ6/Z6Jjy0opM3g7TMEo58TwP4= -github.com/blevesearch/zapx/v14 v14.3.5/go.mod h1:954A/eKFb+pg/ncIYWLWCKY+mIjReM9FGTGIO2Wu1cU= +github.com/blevesearch/zapx/v14 v14.3.6 h1:b9lub7TvcwUyJxK/cQtnN79abngKxsI7zMZnICU0WhE= +github.com/blevesearch/zapx/v14 v14.3.6/go.mod h1:9X8W3XoikagU0rwcTqwZho7p9cC7m7zhPZO94S4wUvM= github.com/blevesearch/zapx/v15 v15.2.0/go.mod h1:MmQceLpWfME4n1WrBFIwplhWmaQbQqLQARpaKUEOs/A= -github.com/blevesearch/zapx/v15 v15.3.5 h1:NVD0qq8vRk66ImJn1KloXT5ckqPDUZT7VbVJs9jKlac= -github.com/blevesearch/zapx/v15 v15.3.5/go.mod h1:QMUh2hXCaYIWFKPYGavq/Iga2zbHWZ9DZAa9uFbWyvg= github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs= github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= @@ -362,7 +356,6 @@ github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67/go.mod h1:BQwMFl github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401 h1:4KDlx3vjalrHD/EfsjCpV91HNX3JPaIqRtt83zZ7x+Y= github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs= github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs= -github.com/couchbase/moss v0.2.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= @@ -1495,6 +1488,8 @@ github.com/yuin/goldmark-highlighting/v2 v2.0.0-20220924101305-151362477c87/go.m github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc= github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0= github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q= +github.com/zeripath/zapx/v15 v15.3.6-alignment-fix h1:fKZ9OxEDoJKgM0KBXRbSb5IgKUEXis6C3zEIiMtzzQ0= +github.com/zeripath/zapx/v15 v15.3.6-alignment-fix/go.mod h1:5DbhhDTGtuQSns1tS2aJxJLPc91boXCvjOMeCLD1saM= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= github.com/zmap/rc2 v0.0.0-20131011165748-24b9757f5521/go.mod h1:3YZ9o3WnatTIZhuOtot4IcUfzoKVjUHqu6WALIyI0nE= github.com/zmap/zcertificate v0.0.0-20180516150559-0e3d58b1bac4/go.mod h1:5iU54tB79AMBcySS0R2XIyZBAVmeHranShAFELYx7is= From 3affb02df517e9081593473137fc287ad51057b7 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 22 Dec 2022 03:09:53 +0100 Subject: [PATCH 06/17] Run hugo via `go run` and lock its version (#22206) - Don't rely on obscure docker images like `plugins/hugo` - Lock down `hugo` to same version the image had used - Remove unnecessary verbosity in `trans-copy` - Rename `trans-copy` to `trans-copy.sh` Co-authored-by: Lunny Xiao Co-authored-by: John Olheiser Co-authored-by: techknowlogick --- .drone.yml | 5 +---- docs/Makefile | 10 ++++++---- docs/scripts/{trans-copy => trans-copy.sh} | 1 - 3 files changed, 7 insertions(+), 9 deletions(-) rename docs/scripts/{trans-copy => trans-copy.sh} (93%) diff --git a/.drone.yml b/.drone.yml index 48ba3e8f97..2b5d21ddf9 100644 --- a/.drone.yml +++ b/.drone.yml @@ -928,11 +928,8 @@ trigger: steps: - name: build-docs - image: plugins/hugo:latest - pull: always + image: golang:1.19 commands: - # https://github.com/drone-plugins/drone-hugo/issues/36 - - apk upgrade --no-cache libcurl && apk add --no-cache make bash curl - cd docs - make trans-copy clean build diff --git a/docs/Makefile b/docs/Makefile index 68afe03e75..fcc932c07d 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,6 +2,8 @@ THEME := themes/gitea PUBLIC := public ARCHIVE := https://dl.gitea.io/theme/master.tar.gz +HUGO_PACKAGE := github.com/gohugoio/hugo@v0.81.0 + .PHONY: all all: build @@ -11,19 +13,19 @@ clean: .PHONY: trans-copy trans-copy: - @bash scripts/trans-copy + bash scripts/trans-copy.sh .PHONY: server server: $(THEME) - hugo server + go run $(HUGO_PACKAGE) server .PHONY: build build: $(THEME) - hugo --cleanDestinationDir + go run $(HUGO_PACKAGE) --cleanDestinationDir .PHONY: build-offline build-offline: $(THEME) - hugo --baseURL="/" --cleanDestinationDir + go run $(HUGO_PACKAGE) --baseURL="/" --cleanDestinationDir .PHONY: update update: $(THEME) diff --git a/docs/scripts/trans-copy b/docs/scripts/trans-copy.sh similarity index 93% rename from docs/scripts/trans-copy rename to docs/scripts/trans-copy.sh index 7732192885..7374ab9e73 100755 --- a/docs/scripts/trans-copy +++ b/docs/scripts/trans-copy.sh @@ -26,7 +26,6 @@ for SOURCE in $(find ${ROOT}/content -type f -iname *.en-us.md); do DEST="${SOURCE%.en-us.md}.${LOCALE}.md" if [[ ! -f ${DEST} ]]; then - echo "Creating fallback for ${DEST#${ROOT}/content/}" cp ${SOURCE} ${DEST} sed -i.bak "s/en\-us/${LOCALE}/g" ${DEST} rm ${DEST}.bak From 6037043adf23dcd87a77c2d0855e2d902e2bacc7 Mon Sep 17 00:00:00 2001 From: Lauris BH Date: Thu, 22 Dec 2022 12:33:17 +0200 Subject: [PATCH 07/17] Fix container layer display overflow (#22208) Before: ![attels](https://user-images.githubusercontent.com/165205/209109653-6c690569-ddbe-4d8b-ab42-66b9a9c6a556.png) After: ![attels](https://user-images.githubusercontent.com/165205/209110521-8aa8fc1c-21c8-4280-9b39-ab560b6d95f4.png) --- templates/package/content/container.tmpl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/package/content/container.tmpl b/templates/package/content/container.tmpl index a79963e732..34d495f356 100644 --- a/templates/package/content/container.tmpl +++ b/templates/package/content/container.tmpl @@ -46,7 +46,7 @@ {{end}} {{if .PackageDescriptor.Metadata.ImageLayers}}

{{.locale.Tr "packages.container.layers"}}

-
+
{{range .PackageDescriptor.Metadata.ImageLayers}} From ac5b44b2f40a8d427805470f334b2c87bc4fdd32 Mon Sep 17 00:00:00 2001 From: silverwind Date: Thu, 22 Dec 2022 12:29:33 +0100 Subject: [PATCH 08/17] Upgrade hugo to 0.82 (#22209) See https://github.com/go-gitea/gitea/pull/22206#issuecomment-1362523796. Apparently hugo 0.81.0 is a broken release in regards to checksums. https://github.com/gohugoio/hugo/releases/tag/v0.82.0 Co-authored-by: Lauris BH --- docs/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/Makefile b/docs/Makefile index fcc932c07d..f47ad4de3c 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -2,7 +2,7 @@ THEME := themes/gitea PUBLIC := public ARCHIVE := https://dl.gitea.io/theme/master.tar.gz -HUGO_PACKAGE := github.com/gohugoio/hugo@v0.81.0 +HUGO_PACKAGE := github.com/gohugoio/hugo@v0.82.0 .PHONY: all all: build From 8c1bb7743784bb0f0754acc7f6855432fddca653 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 22 Dec 2022 21:09:35 +0800 Subject: [PATCH 09/17] Remove test session cache to reduce possible concurrent problem (#22199) --- tests/integration/integration_test.go | 10 ++-------- tests/integration/signout_test.go | 3 --- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/tests/integration/integration_test.go b/tests/integration/integration_test.go index 3537409aeb..911d9ddf4c 100644 --- a/tests/integration/integration_test.go +++ b/tests/integration/integration_test.go @@ -209,8 +209,6 @@ func (s *TestSession) MakeRequestNilResponseHashSumRecorder(t testing.TB, req *h const userPassword = "password" -var loginSessionCache = make(map[string]*TestSession, 10) - func emptyTestSession(t testing.TB) *TestSession { t.Helper() jar, err := cookiejar.New(nil) @@ -225,12 +223,8 @@ func getUserToken(t testing.TB, userName string) string { func loginUser(t testing.TB, userName string) *TestSession { t.Helper() - if session, ok := loginSessionCache[userName]; ok { - return session - } - session := loginUserWithPassword(t, userName, userPassword) - loginSessionCache[userName] = session - return session + + return loginUserWithPassword(t, userName, userPassword) } func loginUserWithPassword(t testing.TB, userName, password string) *TestSession { diff --git a/tests/integration/signout_test.go b/tests/integration/signout_test.go index 0416930c67..0e822ac04e 100644 --- a/tests/integration/signout_test.go +++ b/tests/integration/signout_test.go @@ -21,7 +21,4 @@ func TestSignOut(t *testing.T) { // try to view a private repo, should fail req = NewRequest(t, "GET", "/user2/repo2") session.MakeRequest(t, req, http.StatusNotFound) - - // invalidate cached cookies for user2, for subsequent tests - delete(loginSessionCache, "user2") } From 7bf7c13b64f15f957bc280f0744d34518dde69e9 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Thu, 22 Dec 2022 23:36:01 +0800 Subject: [PATCH 10/17] Frontport 1.17.4 changelog (#22216) --- CHANGELOG.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1150d70081..e9ba23b4c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,60 @@ This changelog goes through all the changes that have been made in each release without substantial changes to our git log; to see the highlights of what has been added to each release, please refer to the [blog](https://blog.gitea.io). +## [1.17.4](https://github.com/go-gitea/gitea/releases/tag/1.17.4) - 2022-12-21 + +* SECURITY + * Do not allow Ghost access to limited visible user/org (#21849) (#21875) + * Fix package access for admins and inactive users (#21580) (#21592) +* ENHANCEMENTS + * Fix button in branch list, avoid unexpected page jump before restore branch actually done (#21562) (#21927) + * Fix vertical align of committer avatar rendered by email address (#21884) (#21919) + * Fix setting HTTP headers after write (#21833) (#21874) + * Ignore line anchor links with leading zeroes (#21728) (#21777) + * Enable Monaco automaticLayout (#21516) +* BUGFIXES + * Do not list active repositories as unadopted (#22034) (#22167) + * Correctly handle moved files in apply patch (#22118) (#22136) + * Fix condition for is_internal (#22095) (#22131) + * Fix permission check on issue/pull lock (#22114) + * Fix sorting admin user list by last login (#22081) (#22106) + * Workaround for container registry push/pull errors (#21862) (#22069) + * Fix issue/PR numbers (#22037) (#22045) + * Handle empty author names (#21902) (#22028) + * Fix ListBranches to handle empty case (#21921) (#22025) + * Fix enabling partial clones on 1.17 (#21809) + * Prevent panic in doctor command when running default checks (#21791) (#21808) + * Upgrade golang.org/x/crypto (#21792) (#21794) + * Init git module before database migration (#21764) (#21766) + * Set last login when activating account (#21731) (#21754) + * Add HEAD fix to gitea doctor (#21352) (#21751) + * Fix UI language switching bug (#21597) (#21748) + * Remove semver compatible flag and change pypi to an array of test cases (#21708) (#21729) + * Allow local package identifiers for PyPI packages (#21690) (#21726) + * Fix repository adoption on Windows (#21646) (#21651) + * Sync git hooks when config file path changed (#21619) (#21625) + * Added check for disabled Packages (#21540) (#21614) + * Fix `Timestamp.IsZero` (#21593) (#21604) + * Fix issues count bug (#21600) + * Support binary deploy in npm packages (#21589) + * Update milestone counters when issue is deleted (#21459) (#21586) + * SessionUser protection against nil pointer dereference (#21581) + * Case-insensitive NuGet symbol file GUID (#21409) (#21575) + * Suppress `ExternalLoginUserNotExist` error (#21504) (#21572) + * Prevent Authorization header for presigned LFS urls (#21531) (#21569) + * Update binding to fix bugs (#21560) + * Fix generating compare link (#21519) (#21530) + * Ignore error when retrieving changed PR review files (#21487) (#21524) + * Fix incorrect notification commit url (#21479) (#21483) + * Display total commit count in hook message (#21400) (#21481) + * Enforce grouped NuGet search results (#21442) (#21480) + * Return 404 when user is not found on avatar (#21476) (#21477) + * Normalize NuGet package version on upload (#22186) (#22201) +* MISC + * Check for zero time instant in TimeStamp.IsZero() (#22171) (#22173) + * Fix warn in database structs sync (#22111) + * Allow for resolution of NPM registry paths that match upstream (#21568) (#21723) + ## [1.17.3](https://github.com/go-gitea/gitea/releases/tag/v1.17.3) - 2022-10-15 * SECURITY From ea5a752ee66f5f8dccbc058c4e1220e24e01b3e8 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Thu, 22 Dec 2022 10:47:57 -0500 Subject: [PATCH 11/17] update docs latest to 1.17.4 --- docs/config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/config.yaml b/docs/config.yaml index 91afc2e972..b80602cb61 100644 --- a/docs/config.yaml +++ b/docs/config.yaml @@ -18,7 +18,7 @@ params: description: Git with a cup of tea author: The Gitea Authors website: https://docs.gitea.io - version: 1.17.3 + version: 1.17.4 minGoVersion: 1.18 goVersion: 1.19 minNodeVersion: 14 From a2779def36590518157c4315a02e7cbaefcecb92 Mon Sep 17 00:00:00 2001 From: Nick Date: Thu, 22 Dec 2022 18:41:56 -0500 Subject: [PATCH 12/17] Test views of LFS files (#22196) --- CONTRIBUTING.md | 2 + models/db/iterate_test.go | 2 +- models/fixtures/lfs_meta_object.yml | 32 +++++++ models/fixtures/repo_unit.yml | 6 ++ models/fixtures/repository.yml | 11 +++ models/fixtures/user.yml | 2 +- ...51df93acc2bdd9e6373be478b968e4cad6b6647351 | Bin 0 -> 107 bytes ...2daa20075cff1d97d9d2349a8977efe9c03661737c | Bin 0 -> 2048 bytes ...69b67fee2b698ef7e9399c4ca4f34a14ccbe39f623 | 1 + ...ec6afe9ea052f3c9b6ff9f4b07956d8c48c86fca82 | 1 + .../user2/lfs.git/HEAD | 1 + .../user2/lfs.git/config | 4 + .../15/2de0f78bc6815b58cd9f08aebe3f66fb0f172e | Bin 0 -> 228 bytes .../23/10e4a07f9314a1a92fdfbdcd3d2884f01e96ab | Bin 0 -> 123 bytes .../2b/6c6c4eaefa24b22f2092c3d54b263ff26feb58 | Bin 0 -> 122 bytes .../73/cf03db6ece34e12bf91e8853dc58f678f2f82d | 2 + .../74/21a018a7e3f15ee5691f162d0ed87dc19882f0 | Bin 0 -> 123 bytes .../82/76d2a29779af982c0afa976bdb793b52d442a8 | Bin 0 -> 38 bytes .../bc/e50ea8f203ee923d5a640d05208abf3206486e | Bin 0 -> 92 bytes .../d4/a41a0d4db4949e129bd22f871171ea988103ef | Bin 0 -> 123 bytes .../d7/ce0013ced38b0696dd2d68d69a5d8b652f7148 | Bin 0 -> 55 bytes .../df/d8105b264d304c49ed9f1d56bd90189ecdf833 | Bin 0 -> 75 bytes .../user2/lfs.git/refs/heads/master | 1 + tests/integration/lfs_view_test.go | 83 ++++++++++++++++++ tests/test_utils.go | 28 ++++++ 25 files changed, 174 insertions(+), 2 deletions(-) create mode 100644 models/fixtures/lfs_meta_object.yml create mode 100644 tests/gitea-lfs-meta/0b/8d/8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351 create mode 100644 tests/gitea-lfs-meta/2e/cc/db43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c create mode 100644 tests/gitea-lfs-meta/7b/6b/2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623 create mode 100644 tests/gitea-lfs-meta/9d/17/2e5c64b4f0024b9901ec6afe9ea052f3c9b6ff9f4b07956d8c48c86fca82 create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/HEAD create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/config create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/15/2de0f78bc6815b58cd9f08aebe3f66fb0f172e create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/23/10e4a07f9314a1a92fdfbdcd3d2884f01e96ab create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/2b/6c6c4eaefa24b22f2092c3d54b263ff26feb58 create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/73/cf03db6ece34e12bf91e8853dc58f678f2f82d create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/74/21a018a7e3f15ee5691f162d0ed87dc19882f0 create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/82/76d2a29779af982c0afa976bdb793b52d442a8 create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/bc/e50ea8f203ee923d5a640d05208abf3206486e create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/d4/a41a0d4db4949e129bd22f871171ea988103ef create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/d7/ce0013ced38b0696dd2d68d69a5d8b652f7148 create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/objects/df/d8105b264d304c49ed9f1d56bd90189ecdf833 create mode 100644 tests/gitea-repositories-meta/user2/lfs.git/refs/heads/master create mode 100644 tests/integration/lfs_view_test.go diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 69363c415e..bd5672643a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -190,6 +190,8 @@ To maintain understandable code and avoid circular dependencies it is important - **templates:** Golang templates for generating the html output. - **tests/e2e:** End to end tests - **tests/integration:** Integration tests +- **tests/gitea-repositories-meta:** Sample repos used in integration tests. Adding a new repo requires editing `models/fixtures/repositories.yml` and `models/fixtures/repo_unit.yml` to match. +- **tests/gitea-lfs-meta:** Sample LFS objects used in integration tests. Adding a new object requires editing `models/fixtures/lfs_meta_object.yml` to match. - **vendor:** External code that Gitea depends on. ## Documentation diff --git a/models/db/iterate_test.go b/models/db/iterate_test.go index 57b1bd3cd1..63487afa49 100644 --- a/models/db/iterate_test.go +++ b/models/db/iterate_test.go @@ -25,7 +25,7 @@ func TestIterate(t *testing.T) { return nil }) assert.NoError(t, err) - assert.EqualValues(t, 80, repoCnt) + assert.EqualValues(t, 81, repoCnt) err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repoUnit *repo_model.RepoUnit) error { reopUnit2 := repo_model.RepoUnit{ID: repoUnit.ID} diff --git a/models/fixtures/lfs_meta_object.yml b/models/fixtures/lfs_meta_object.yml new file mode 100644 index 0000000000..1c29e02d44 --- /dev/null +++ b/models/fixtures/lfs_meta_object.yml @@ -0,0 +1,32 @@ +# These are the LFS objects in user2/lfs.git +- + + id: 1 + oid: 0b8d8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351 + size: 107 + repository_id: 54 + created_unix: 1671607299 + +- + + id: 2 + oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c + size: 107 + repository_id: 54 + created_unix: 1671607299 + +- + + id: 3 + oid: 7b6b2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623 + size: 27 + repository_id: 54 + created_unix: 1671607299 + +- + + id: 4 + oid: 9d172e5c64b4f0024b9901ec6afe9ea052f3c9b6ff9f4b07956d8c48c86fca82 + size: 25 + repository_id: 54 + created_unix: 1671607299 diff --git a/models/fixtures/repo_unit.yml b/models/fixtures/repo_unit.yml index 73db47218b..8706717ad4 100644 --- a/models/fixtures/repo_unit.yml +++ b/models/fixtures/repo_unit.yml @@ -550,3 +550,9 @@ repo_id: 53 type: 1 created_unix: 946684810 + +- + id: 81 + repo_id: 54 + type: 1 + created_unix: 946684810 diff --git a/models/fixtures/repository.yml b/models/fixtures/repository.yml index a5a3dd0601..19b243fb4e 100644 --- a/models/fixtures/repository.yml +++ b/models/fixtures/repository.yml @@ -1585,3 +1585,14 @@ size: 0 is_fsck_enabled: true close_issues_via_commit_in_any_branch: false + +- + id: 54 + owner_id: 2 + owner_name: user2 + lower_name: lfs + name: lfs + is_empty: false + is_archived: false + is_private: true + status: 0 diff --git a/models/fixtures/user.yml b/models/fixtures/user.yml index 1b870e8999..3afed37df9 100644 --- a/models/fixtures/user.yml +++ b/models/fixtures/user.yml @@ -66,7 +66,7 @@ num_followers: 2 num_following: 1 num_stars: 2 - num_repos: 9 + num_repos: 10 num_teams: 0 num_members: 0 visibility: 0 diff --git a/tests/gitea-lfs-meta/0b/8d/8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351 b/tests/gitea-lfs-meta/0b/8d/8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351 new file mode 100644 index 0000000000000000000000000000000000000000..71911bf48766c7181518c1070911019fbb00b1fc GIT binary patch literal 107 zcmWm0!3~2z3BFw1LcRN$56tDMjb(bi?{eATtlXa|VKh1l`w8D*l;b#vKL zDhGd<+=t1S(kr_Uq1wCGcm2rSj~Ja=v(_c3PXZ!SH(i4N!^}WYL1$?wv3AL9h!!64 zezaB2My9;Dd5E68jnYK&;bErIi`PXtNl{++0SWRW7aQjIFbKS=61nQ1##y;4}if_nP? zN8=#J=dA{pqq=;`di=*1%k>EMO*tMSw#`$IPU@7Piu?H5pja5W>2u!+G{%qhw6DtN z`jD}?%JUiXh#&4IXfhwWQ`Duh)=6BiGq`v?yz6}V;3C4oBFjbPvQ3ffeRK@WZ%lra zFwtYZXDBx^$^`-JGapfv`Tcx1>*E`6_j96$G16+41y`z|3HM>(G5BMeW^`0+NshsP zMisDH5{DSPBqhLWbUzgaB%ME3C0}`GS2j6B-0n&pF@F6h**WSnz=&RU=5Z8p>#4)( zf|sIDV2=dVEAkcf^v=l_^%{W>E(Wz~FBG>G03zn;OT3?$&NPS%WA37ROxhPXlN+Zx zcQjzETSUNIfTv$od|{Xzmp(yaFXg2n+1_VUov1R`Ip-of>e2hb$Xb7a3VK zEy*q|aZlPADg+3xsDEdLa8_*-lxu>u>|Zk!r5l|{PCT#P-UwsM;Q7H%E+;?tnhX<+Mb%ulIF1}1_OLfKAm69 zb4Gwmxg;FpRKpvvJQUKgP+T{oF<}E*)%T`lC;PXB8V_-s)bkCscSX^a^tBMPZwGUo zfi|}w?g@{&%*x2vI^bk`E-7&~*~U+7wxSLZmFw6>%%r1S2ZtAdj|IxH@4H1$9PU8!5Y{S4*kKGD z<2EyzRT`Qz%x$QGtzm|cLN`snkk{7ArXFg1EjSDnLLOc1;~ah=po$WIECI2}a_vqX zPL3^2C{;LZ1|W23&-#7rY(&R&o7AH*?>O*vJbfEwx-CaC@xe%`)qNFT|0?XC*hYib zQtY&cRMD|r_E$&5NQ{))Y!N6051r#%U=A*eJSi1uHv@CU{`{racwCo~XhSqU7szb_ z9CwQ0LoST)EkW5-a-0w3AL{`_oW}}KRZc|Uj zA&`f>=n6)r>j9dFOi?!1#Z|<#?*KLU3C;>zN{LzQG!mHrI#wow?>p%pa*TZR@0UHA-g72#>Z0~q zHEM_2G+#{|P@~oG5%Hi`vO#G^-)1=e_#Qa7UbmT)_LMxg8Z$X>`W$6~6tf>M?wr1R zDKm}B0rMShfjH-;8$QMg4~D3QYMsVkAO}Mt?Ysi{QY2dEy5OF4Aq~?x2t>cveH79q zlLWqK>`~MF%*jgoEF@=d4$2WgRJpw@VIb>DS=lDvRUF3aR-4F&em|1d{Od95fGMk0 zc&g0UOo*m8(o^qPeryGN&d{W~7?(R&i>WoeGk_a2V1f<=xo0?TwXoPV`rSDA=!sRb zo49VPfxu?|HbJBs*(s;D5N}ZODSa=IpX%64h7{i2w2L_=u{H(;j*PX!|9BOd`;Sjw zR>sEbPd=cAvD^$9(7DjSb0vE1Z9XQJEb(m$$NGcU=N!Z7?1}_xLwBq2(9*6JOKwvG zBle2X{b2hy16-90YP5pI`1vpXPqrA)K@5BEd)7JFxZzG$Sa?`3cB&BCH8P69Q4V)^ z@U*A0f8-XH_E3j$sgEnN7%Le1w{yTp<8y#yJartOvz|&mBn0}SDeFusXfAY-*izN! zf0sxbs%&QxjE>|cd$^M#gF5q5bo>B+3iQcCNZV=T9TTmdE ziyOv`g?EY!G{Nyx$aOf&;EfwwQHRu>Rx~*10MmSHxJrn4x}u_w`4Z$Dd`J6^I2x#O zlB&Gl9oz1%1=E8kJuEk^6+7VHJHfC6x@|6ekkeN0RA_ZP%*+i&wFx<6nI7XWWkbeJ zzA{fIVsQcBbp1A*>)M(VsNtIT+-H+3x8+Qn=oI%&Ai=WKw15vS2VYFfcPQQP4}zEJ-XWDauSLElDkAxPL<+TFuwM$Mfxc z*|5D6B<7v{VGLF2?C%#6geL@3R2Wmc4^V{%JnmJxPDE~zFlb@bj4`}R8ewKWkHEvQf3~*l_gTVzFVfu6PkTV zzg@8K)r>~w_fSPy1*z$JSq13~C5j6qmOuU&_cT*pOqcIQ?ZFvMA508@K%uxaDJ8Rr eVb4>(6`z>jO|p$j;bm3m+Hb_>kp}=pu32{6hHke2 literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/23/10e4a07f9314a1a92fdfbdcd3d2884f01e96ab b/tests/gitea-repositories-meta/user2/lfs.git/objects/23/10e4a07f9314a1a92fdfbdcd3d2884f01e96ab new file mode 100644 index 0000000000000000000000000000000000000000..16a791a4ab4294466079e8128b8cd267f3f2c775 GIT binary patch literal 123 zcmV->0EGW|0S(1L5`!QN0KlGo1s|wD3P}77iAiO~7DudyzP{bd($>g$m~NLGy|%Ym z&vWmywaM{8 dq>38IO&HUXIb_aBxnvl6{fdD&`~bC&DV%{iJfi>r literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/2b/6c6c4eaefa24b22f2092c3d54b263ff26feb58 b/tests/gitea-repositories-meta/user2/lfs.git/objects/2b/6c6c4eaefa24b22f2092c3d54b263ff26feb58 new file mode 100644 index 0000000000000000000000000000000000000000..d8d55b14fa1bc6ff5d781be1e48f53561c2304de GIT binary patch literal 122 zcmV-=0EPc}0S(1V62c%108rPQf(uyW(?EI~k_KU>N~hE=JiWfnqpg#+F5WIVM(b}~ z&vPG(G0%41w=$;x^+OZ)ml?aTxvc7K)uU!N!x9O|aY`#?ED;{r<~apGf>=Zx0VXL? c&?9o-9EuOw24)hE1)Nu-eMP&de#l8F*E@kWc>n+a literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/73/cf03db6ece34e12bf91e8853dc58f678f2f82d b/tests/gitea-repositories-meta/user2/lfs.git/objects/73/cf03db6ece34e12bf91e8853dc58f678f2f82d new file mode 100644 index 0000000000..5eee31d8aa --- /dev/null +++ b/tests/gitea-repositories-meta/user2/lfs.git/objects/73/cf03db6ece34e12bf91e8853dc58f678f2f82d @@ -0,0 +1,2 @@ +xQ +B!EvbƗAD70V¹'RrMY0Y";28:/AĜ&Z_6]g\dk9%ihXG?O]g@}97 \ No newline at end of file diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/74/21a018a7e3f15ee5691f162d0ed87dc19882f0 b/tests/gitea-repositories-meta/user2/lfs.git/objects/74/21a018a7e3f15ee5691f162d0ed87dc19882f0 new file mode 100644 index 0000000000000000000000000000000000000000..cbbde812d7aa0c8a42c6d0f2a0fe19abb9282a48 GIT binary patch literal 123 zcmV->0EGW|0S(1L62c%106@=u1s|{!5(4x$gn(tHN=IrBzFzmTymwZ{hTB!%qxF~C z&hr?n){l1H_d4eP+lS}epL!f6>&r~Ni5gq7j@E^P1a{T91ql$UfUW3^)CehO%ObH5 dc;JFQaHLQ$Cm|+656(=ZeTy=SpMKb_DPlJ|J6iw% literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/82/76d2a29779af982c0afa976bdb793b52d442a8 b/tests/gitea-repositories-meta/user2/lfs.git/objects/82/76d2a29779af982c0afa976bdb793b52d442a8 new file mode 100644 index 0000000000000000000000000000000000000000..cbee9fb5a0aba392bab4eb4459fb5255e7f883ac GIT binary patch literal 38 ucmb7IDb#L&E-<1+v?g%BeE literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/bc/e50ea8f203ee923d5a640d05208abf3206486e b/tests/gitea-repositories-meta/user2/lfs.git/objects/bc/e50ea8f203ee923d5a640d05208abf3206486e new file mode 100644 index 0000000000000000000000000000000000000000..83e8159975cb9efbb8f2dcc2e219cd6d1f23e5d7 GIT binary patch literal 92 zcmV-i0HgnS0V^p=O;s?rWH2-^Ff%bx&`ZxONh~QT%1kOPNiAl$evU!-+~sbzX?Jxq yuFZ<=PSr2;fT|2~b#(D{)yqv`P!@QypnkH*!j<~>_nx)YX!#&FZ8ZQo(IC?S&MR^N literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/d4/a41a0d4db4949e129bd22f871171ea988103ef b/tests/gitea-repositories-meta/user2/lfs.git/objects/d4/a41a0d4db4949e129bd22f871171ea988103ef new file mode 100644 index 0000000000000000000000000000000000000000..01f6e7bc630fa24e36852cac598a7b341456b6d3 GIT binary patch literal 123 zcmV->0EGW|0S(2$5yBu406^bVK?4RjAmq{w+<`C?B_o)J)$4vX9X&|{c)Rj@wEmKH z&U5TaJ=(keCoR;UYMhzWWkhc*M~&du9WoIoXE*Q+(IF$Ucfc`%*1=OLhA}WQ dSch@L5OT>#+ODe!Hjo(Yn3V+e9}bn$i7%S};8%giZBEwar?D^^I!OiKeZa#M@aQ^73V NlGKV4E&$$05(t)97Z?Bl literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/objects/df/d8105b264d304c49ed9f1d56bd90189ecdf833 b/tests/gitea-repositories-meta/user2/lfs.git/objects/df/d8105b264d304c49ed9f1d56bd90189ecdf833 new file mode 100644 index 0000000000000000000000000000000000000000..11940b8f795fe8dd75046c644ca8dce1db2e64a0 GIT binary patch literal 75 zcmV-R0JQ&j0ZYosPf{>6He+!1_X`Q~bP5ge^mEtCO;Je8%qdANvdu{=R!GTAO9L}< hQ;X75!7Sa9)QS==ExoLQbRtzIW#$p35&+pLF|PB9AgurZ literal 0 HcmV?d00001 diff --git a/tests/gitea-repositories-meta/user2/lfs.git/refs/heads/master b/tests/gitea-repositories-meta/user2/lfs.git/refs/heads/master new file mode 100644 index 0000000000..8832a3e857 --- /dev/null +++ b/tests/gitea-repositories-meta/user2/lfs.git/refs/heads/master @@ -0,0 +1 @@ +73cf03db6ece34e12bf91e8853dc58f678f2f82d diff --git a/tests/integration/lfs_view_test.go b/tests/integration/lfs_view_test.go new file mode 100644 index 0000000000..1775fa629f --- /dev/null +++ b/tests/integration/lfs_view_test.go @@ -0,0 +1,83 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package integration + +import ( + "net/http" + "testing" + + "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" +) + +// check that files stored in LFS render properly in the web UI +func TestLFSRender(t *testing.T) { + defer tests.PrepareTestEnv(t)() + + session := loginUser(t, "user2") + + // check that a markup file is flagged with "Stored in Git LFS" and shows its text + t.Run("Markup", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/CONTRIBUTING.md") + resp := session.MakeRequest(t, req, http.StatusOK) + + doc := NewHTMLParser(t, resp.Body).doc + + fileInfo := doc.Find("div.file-info-entry").First().Text() + assert.Contains(t, fileInfo, "Stored with Git LFS") + + content := doc.Find("div.file-view").Text() + assert.Contains(t, content, "Testing documents in LFS") + }) + + // check that an image is flagged with "Stored in Git LFS" and renders inline + t.Run("Image", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/jpeg.jpg") + resp := session.MakeRequest(t, req, http.StatusOK) + + doc := NewHTMLParser(t, resp.Body).doc + + fileInfo := doc.Find("div.file-info-entry").First().Text() + assert.Contains(t, fileInfo, "Stored with Git LFS") + + src, exists := doc.Find(".file-view img").Attr("src") + assert.True(t, exists, "The image should be in an tag") + assert.Equal(t, "/user2/lfs/media/branch/master/jpeg.jpg", src, "The image should use the /media link because it's in LFS") + }) + + // check that a binary file is flagged with "Stored in Git LFS" and renders a /media/ link instead of a /raw/ link + t.Run("Binary", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/crypt.bin") + resp := session.MakeRequest(t, req, http.StatusOK) + + doc := NewHTMLParser(t, resp.Body).doc + + fileInfo := doc.Find("div.file-info-entry").First().Text() + assert.Contains(t, fileInfo, "Stored with Git LFS") + + rawLink, exists := doc.Find("div.file-view > div.view-raw > a").Attr("href") + assert.True(t, exists, "Download link should render instead of content because this is a binary file") + assert.Equal(t, "/user2/lfs/media/branch/master/crypt.bin", rawLink, "The download link should use the proper /media link because it's in LFS") + }) + + // check that a directory with a README file shows its text + t.Run("Readme", func(t *testing.T) { + defer tests.PrintCurrentTest(t)() + + req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/subdir") + resp := session.MakeRequest(t, req, http.StatusOK) + + doc := NewHTMLParser(t, resp.Body).doc + + content := doc.Find("div.file-view").Text() + assert.Contains(t, content, "Testing READMEs in LFS") + }) +} diff --git a/tests/test_utils.go b/tests/test_utils.go index b4bd4a011e..721edc86f8 100644 --- a/tests/test_utils.go +++ b/tests/test_utils.go @@ -167,7 +167,11 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() { ourSkip += skip[0] } deferFn := PrintCurrentTest(t, ourSkip) + + // load database fixtures assert.NoError(t, unittest.LoadFixtures()) + + // load git repo fixtures assert.NoError(t, util.RemoveAll(setting.RepoRootPath)) assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath)) ownerDirs, err := os.ReadDir(setting.RepoRootPath) @@ -190,6 +194,16 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() { } } + // load LFS object fixtures + // (LFS storage can be on any of several backends, including remote servers, so we init it with the storage API) + lfsFixtures, err := storage.NewStorage("", storage.LocalStorageConfig{Path: path.Join(filepath.Dir(setting.AppPath), "tests/gitea-lfs-meta")}) + assert.NoError(t, err) + assert.NoError(t, storage.Clean(storage.LFS)) + assert.NoError(t, lfsFixtures.IterateObjects(func(path string, _ storage.Object) error { + _, err := storage.Copy(storage.LFS, path, lfsFixtures, path) + return err + })) + return deferFn } @@ -198,7 +212,11 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() { // within a single test this is required func ResetFixtures(t *testing.T) { assert.NoError(t, queue.GetManager().FlushAll(context.Background(), -1)) + + // load database fixtures assert.NoError(t, unittest.LoadFixtures()) + + // load git repo fixtures assert.NoError(t, util.RemoveAll(setting.RepoRootPath)) assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath)) ownerDirs, err := os.ReadDir(setting.RepoRootPath) @@ -220,4 +238,14 @@ func ResetFixtures(t *testing.T) { _ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0o755) } } + + // load LFS object fixtures + // (LFS storage can be on any of several backends, including remote servers, so we init it with the storage API) + lfsFixtures, err := storage.NewStorage("", storage.LocalStorageConfig{Path: path.Join(filepath.Dir(setting.AppPath), "tests/gitea-lfs-meta")}) + assert.NoError(t, err) + assert.NoError(t, storage.Clean(storage.LFS)) + assert.NoError(t, lfsFixtures.IterateObjects(func(path string, _ storage.Object) error { + _, err := storage.Copy(storage.LFS, path, lfsFixtures, path) + return err + })) } From 41f0668da818d3a3ae74555bfe3de375448bacf3 Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 23 Dec 2022 04:58:30 +0100 Subject: [PATCH 13/17] Hide file borders on sticky diff box (#22217) Before: (1px border left and right when scrolled to a file) Screenshot 2022-12-22 at 15 37 54 After: (no border) Screenshot 2022-12-22 at 15 39 01 Layout in the box does not shift with the changes. Co-authored-by: Lunny Xiao --- web_src/less/_repository.less | 2 ++ 1 file changed, 2 insertions(+) diff --git a/web_src/less/_repository.less b/web_src/less/_repository.less index 0f318fa53c..3ceb9e30c3 100644 --- a/web_src/less/_repository.less +++ b/web_src/less/_repository.less @@ -1595,6 +1595,8 @@ border-bottom: 1px solid var(--color-secondary); padding-left: 2px; padding-right: 2px; + margin-left: -1px; + margin-right: -1px; } > div::after { From 71ca3067bcc6c7c7772d38fc7590505c8c7148ed Mon Sep 17 00:00:00 2001 From: Jason Song Date: Fri, 23 Dec 2022 19:35:43 +0800 Subject: [PATCH 14/17] Check primary keys for all tables and drop ForeignReference (#21721) Some dbs require that all tables have primary keys, see - #16802 - #21086 We can add a test to keep it from being broken again. Edit: ~Added missing primary key for `ForeignReference`~ Dropped the `ForeignReference` table to satisfy the check, so it closes #21086. More context can be found in comments. Signed-off-by: Andrew Thornton Co-authored-by: zeripath --- models/db/engine_test.go | 33 ++++++++++++ models/fixtures/foreign_reference.yml | 1 - models/foreignreference/error.go | 52 ------------------ models/foreignreference/foreignreference.go | 31 ----------- models/issues/issue.go | 60 ++------------------- models/issues/issue_test.go | 34 ------------ models/migrate.go | 7 --- models/migrate_test.go | 12 ----- models/migrations/migrations.go | 2 + models/migrations/v1_19/v237.go | 15 ++++++ services/migrations/gitea_uploader.go | 11 ---- 11 files changed, 55 insertions(+), 203 deletions(-) delete mode 100644 models/fixtures/foreign_reference.yml delete mode 100644 models/foreignreference/error.go delete mode 100644 models/foreignreference/foreignreference.go create mode 100644 models/migrations/v1_19/v237.go diff --git a/models/db/engine_test.go b/models/db/engine_test.go index fa1ac08a17..5514366777 100644 --- a/models/db/engine_test.go +++ b/models/db/engine_test.go @@ -12,6 +12,8 @@ import ( "code.gitea.io/gitea/models/unittest" "code.gitea.io/gitea/modules/setting" + _ "code.gitea.io/gitea/cmd" // for TestPrimaryKeys + "github.com/stretchr/testify/assert" ) @@ -51,3 +53,34 @@ func TestDeleteOrphanedObjects(t *testing.T) { assert.NoError(t, err) assert.EqualValues(t, countBefore, countAfter) } + +func TestPrimaryKeys(t *testing.T) { + // Some dbs require that all tables have primary keys, see + // https://github.com/go-gitea/gitea/issues/21086 + // https://github.com/go-gitea/gitea/issues/16802 + // To avoid creating tables without primary key again, this test will check them. + // Import "code.gitea.io/gitea/cmd" to make sure each db.RegisterModel in init functions has been called. + + beans, err := db.NamesToBean() + if err != nil { + t.Fatal(err) + } + + whitelist := map[string]string{ + "the_table_name_to_skip_checking": "Write a note here to explain why", + } + + for _, bean := range beans { + table, err := db.TableInfo(bean) + if err != nil { + t.Fatal(err) + } + if why, ok := whitelist[table.Name]; ok { + t.Logf("ignore %q because %q", table.Name, why) + continue + } + if len(table.PrimaryKeys) == 0 { + t.Errorf("table %q has no primary key", table.Name) + } + } +} diff --git a/models/fixtures/foreign_reference.yml b/models/fixtures/foreign_reference.yml deleted file mode 100644 index ca780a73aa..0000000000 --- a/models/fixtures/foreign_reference.yml +++ /dev/null @@ -1 +0,0 @@ -[] # empty diff --git a/models/foreignreference/error.go b/models/foreignreference/error.go deleted file mode 100644 index 07ed1052a6..0000000000 --- a/models/foreignreference/error.go +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2022 Gitea. All rights reserved. -// SPDX-License-Identifier: MIT - -package foreignreference - -import ( - "fmt" - - "code.gitea.io/gitea/modules/util" -) - -// ErrLocalIndexNotExist represents a "LocalIndexNotExist" kind of error. -type ErrLocalIndexNotExist struct { - RepoID int64 - ForeignIndex int64 - Type string -} - -// ErrLocalIndexNotExist checks if an error is a ErrLocalIndexNotExist. -func IsErrLocalIndexNotExist(err error) bool { - _, ok := err.(ErrLocalIndexNotExist) - return ok -} - -func (err ErrLocalIndexNotExist) Error() string { - return fmt.Sprintf("repository %d has no LocalIndex for ForeignIndex %d of type %s", err.RepoID, err.ForeignIndex, err.Type) -} - -func (err ErrLocalIndexNotExist) Unwrap() error { - return util.ErrNotExist -} - -// ErrForeignIndexNotExist represents a "ForeignIndexNotExist" kind of error. -type ErrForeignIndexNotExist struct { - RepoID int64 - LocalIndex int64 - Type string -} - -// ErrForeignIndexNotExist checks if an error is a ErrForeignIndexNotExist. -func IsErrForeignIndexNotExist(err error) bool { - _, ok := err.(ErrForeignIndexNotExist) - return ok -} - -func (err ErrForeignIndexNotExist) Error() string { - return fmt.Sprintf("repository %d has no ForeignIndex for LocalIndex %d of type %s", err.RepoID, err.LocalIndex, err.Type) -} - -func (err ErrForeignIndexNotExist) Unwrap() error { - return util.ErrNotExist -} diff --git a/models/foreignreference/foreignreference.go b/models/foreignreference/foreignreference.go deleted file mode 100644 index 2d2ad04c5a..0000000000 --- a/models/foreignreference/foreignreference.go +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright 2022 Gitea. All rights reserved. -// SPDX-License-Identifier: MIT - -package foreignreference - -import ( - "code.gitea.io/gitea/models/db" -) - -// Type* are valid values for the Type field of ForeignReference -const ( - TypeIssue = "issue" - TypePullRequest = "pull_request" - TypeComment = "comment" - TypeReview = "review" - TypeReviewComment = "review_comment" - TypeRelease = "release" -) - -// ForeignReference represents external references -type ForeignReference struct { - // RepoID is the first column in all indices. now we only need 2 indices: (repo, local) and (repo, foreign, type) - RepoID int64 `xorm:"UNIQUE(repo_foreign_type) INDEX(repo_local)" ` - LocalIndex int64 `xorm:"INDEX(repo_local)"` // the resource key inside Gitea, it can be IssueIndex, or some model ID. - ForeignIndex string `xorm:"INDEX UNIQUE(repo_foreign_type)"` - Type string `xorm:"VARCHAR(16) INDEX UNIQUE(repo_foreign_type)"` -} - -func init() { - db.RegisterModel(new(ForeignReference)) -} diff --git a/models/issues/issue.go b/models/issues/issue.go index fc93fcf454..f45e635c0e 100644 --- a/models/issues/issue.go +++ b/models/issues/issue.go @@ -9,11 +9,9 @@ import ( "fmt" "regexp" "sort" - "strconv" "strings" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/foreignreference" "code.gitea.io/gitea/models/organization" "code.gitea.io/gitea/models/perm" access_model "code.gitea.io/gitea/models/perm/access" @@ -136,12 +134,11 @@ type Issue struct { UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"` ClosedUnix timeutil.TimeStamp `xorm:"INDEX"` - Attachments []*repo_model.Attachment `xorm:"-"` - Comments []*Comment `xorm:"-"` - Reactions ReactionList `xorm:"-"` - TotalTrackedTime int64 `xorm:"-"` - Assignees []*user_model.User `xorm:"-"` - ForeignReference *foreignreference.ForeignReference `xorm:"-"` + Attachments []*repo_model.Attachment `xorm:"-"` + Comments []*Comment `xorm:"-"` + Reactions ReactionList `xorm:"-"` + TotalTrackedTime int64 `xorm:"-"` + Assignees []*user_model.User `xorm:"-"` // IsLocked limits commenting abilities to users on an issue // with write access @@ -321,29 +318,6 @@ func (issue *Issue) loadReactions(ctx context.Context) (err error) { return nil } -func (issue *Issue) loadForeignReference(ctx context.Context) (err error) { - if issue.ForeignReference != nil { - return nil - } - reference := &foreignreference.ForeignReference{ - RepoID: issue.RepoID, - LocalIndex: issue.Index, - Type: foreignreference.TypeIssue, - } - has, err := db.GetEngine(ctx).Get(reference) - if err != nil { - return err - } else if !has { - return foreignreference.ErrForeignIndexNotExist{ - RepoID: issue.RepoID, - LocalIndex: issue.Index, - Type: foreignreference.TypeIssue, - } - } - issue.ForeignReference = reference - return nil -} - // LoadMilestone load milestone of this issue. func (issue *Issue) LoadMilestone(ctx context.Context) (err error) { if (issue.Milestone == nil || issue.Milestone.ID != issue.MilestoneID) && issue.MilestoneID > 0 { @@ -406,10 +380,6 @@ func (issue *Issue) LoadAttributes(ctx context.Context) (err error) { } } - if err = issue.loadForeignReference(ctx); err != nil && !foreignreference.IsErrForeignIndexNotExist(err) { - return err - } - return issue.loadReactions(ctx) } @@ -1097,26 +1067,6 @@ func GetIssueByIndex(repoID, index int64) (*Issue, error) { return issue, nil } -// GetIssueByForeignIndex returns raw issue by foreign ID -func GetIssueByForeignIndex(ctx context.Context, repoID, foreignIndex int64) (*Issue, error) { - reference := &foreignreference.ForeignReference{ - RepoID: repoID, - ForeignIndex: strconv.FormatInt(foreignIndex, 10), - Type: foreignreference.TypeIssue, - } - has, err := db.GetEngine(ctx).Get(reference) - if err != nil { - return nil, err - } else if !has { - return nil, foreignreference.ErrLocalIndexNotExist{ - RepoID: repoID, - ForeignIndex: foreignIndex, - Type: foreignreference.TypeIssue, - } - } - return GetIssueByIndex(repoID, reference.LocalIndex) -} - // GetIssueWithAttrsByIndex returns issue by index in a repository. func GetIssueWithAttrsByIndex(repoID, index int64) (*Issue, error) { issue, err := GetIssueByIndex(repoID, index) diff --git a/models/issues/issue_test.go b/models/issues/issue_test.go index 6764a9e626..de1da19ab9 100644 --- a/models/issues/issue_test.go +++ b/models/issues/issue_test.go @@ -7,13 +7,11 @@ import ( "context" "fmt" "sort" - "strconv" "sync" "testing" "time" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/foreignreference" issues_model "code.gitea.io/gitea/models/issues" "code.gitea.io/gitea/models/organization" repo_model "code.gitea.io/gitea/models/repo" @@ -501,38 +499,6 @@ func TestCorrectIssueStats(t *testing.T) { assert.EqualValues(t, issueStats.OpenCount, issueAmount) } -func TestIssueForeignReference(t *testing.T) { - assert.NoError(t, unittest.PrepareTestDatabase()) - issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 4}) - assert.NotEqualValues(t, issue.Index, issue.ID) // make sure they are different to avoid false positive - - // it is fine for an issue to not have a foreign reference - err := issue.LoadAttributes(db.DefaultContext) - assert.NoError(t, err) - assert.Nil(t, issue.ForeignReference) - - var foreignIndex int64 = 12345 - _, err = issues_model.GetIssueByForeignIndex(context.Background(), issue.RepoID, foreignIndex) - assert.True(t, foreignreference.IsErrLocalIndexNotExist(err)) - - err = db.Insert(db.DefaultContext, &foreignreference.ForeignReference{ - LocalIndex: issue.Index, - ForeignIndex: strconv.FormatInt(foreignIndex, 10), - RepoID: issue.RepoID, - Type: foreignreference.TypeIssue, - }) - assert.NoError(t, err) - - err = issue.LoadAttributes(db.DefaultContext) - assert.NoError(t, err) - - assert.EqualValues(t, issue.ForeignReference.ForeignIndex, strconv.FormatInt(foreignIndex, 10)) - - found, err := issues_model.GetIssueByForeignIndex(context.Background(), issue.RepoID, foreignIndex) - assert.NoError(t, err) - assert.EqualValues(t, found.Index, issue.Index) -} - func TestMilestoneList_LoadTotalTrackedTimes(t *testing.T) { assert.NoError(t, unittest.PrepareTestDatabase()) miles := issues_model.MilestoneList{ diff --git a/models/migrate.go b/models/migrate.go index b1b5568126..82cacd4a75 100644 --- a/models/migrate.go +++ b/models/migrate.go @@ -83,13 +83,6 @@ func insertIssue(ctx context.Context, issue *issues_model.Issue) error { } } - if issue.ForeignReference != nil { - issue.ForeignReference.LocalIndex = issue.Index - if _, err := sess.Insert(issue.ForeignReference); err != nil { - return err - } - } - return nil } diff --git a/models/migrate_test.go b/models/migrate_test.go index 48cd905e4c..42102f9a7d 100644 --- a/models/migrate_test.go +++ b/models/migrate_test.go @@ -4,11 +4,9 @@ package models import ( - "strconv" "testing" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/foreignreference" issues_model "code.gitea.io/gitea/models/issues" repo_model "code.gitea.io/gitea/models/repo" "code.gitea.io/gitea/models/unittest" @@ -48,7 +46,6 @@ func assertCreateIssues(t *testing.T, isPull bool) { UserID: owner.ID, } - foreignIndex := int64(12345) title := "issuetitle1" is := &issues_model.Issue{ RepoID: repo.ID, @@ -62,20 +59,11 @@ func assertCreateIssues(t *testing.T, isPull bool) { IsClosed: true, Labels: []*issues_model.Label{label}, Reactions: []*issues_model.Reaction{reaction}, - ForeignReference: &foreignreference.ForeignReference{ - ForeignIndex: strconv.FormatInt(foreignIndex, 10), - RepoID: repo.ID, - Type: foreignreference.TypeIssue, - }, } err := InsertIssues(is) assert.NoError(t, err) i := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{Title: title}) - assert.Nil(t, i.ForeignReference) - err = i.LoadAttributes(db.DefaultContext) - assert.NoError(t, err) - assert.EqualValues(t, strconv.FormatInt(foreignIndex, 10), i.ForeignReference.ForeignIndex) unittest.AssertExistsAndLoadBean(t, &issues_model.Reaction{Type: "heart", UserID: owner.ID, IssueID: i.ID}) } diff --git a/models/migrations/migrations.go b/models/migrations/migrations.go index 591bfa3e86..9d9c8f5165 100644 --- a/models/migrations/migrations.go +++ b/models/migrations/migrations.go @@ -444,6 +444,8 @@ var migrations = []Migration{ NewMigration("Add index for access_token", v1_19.AddIndexForAccessToken), // v236 -> v237 NewMigration("Create secrets table", v1_19.CreateSecretsTable), + // v237 -> v238 + NewMigration("Drop ForeignReference table", v1_19.DropForeignReferenceTable), } // GetCurrentDBVersion returns the current db version diff --git a/models/migrations/v1_19/v237.go b/models/migrations/v1_19/v237.go new file mode 100644 index 0000000000..b23c765aa5 --- /dev/null +++ b/models/migrations/v1_19/v237.go @@ -0,0 +1,15 @@ +// Copyright 2022 The Gitea Authors. All rights reserved. +// SPDX-License-Identifier: MIT + +package v1_19 //nolint + +import ( + "xorm.io/xorm" +) + +func DropForeignReferenceTable(x *xorm.Engine) error { + // Drop the table introduced in `v211`, it's considered badly designed and doesn't look like to be used. + // See: https://github.com/go-gitea/gitea/issues/21086#issuecomment-1318217453 + type ForeignReference struct{} + return x.DropTables(new(ForeignReference)) +} diff --git a/services/migrations/gitea_uploader.go b/services/migrations/gitea_uploader.go index f3848e616c..23aa4ac2ca 100644 --- a/services/migrations/gitea_uploader.go +++ b/services/migrations/gitea_uploader.go @@ -17,7 +17,6 @@ import ( "code.gitea.io/gitea/models" "code.gitea.io/gitea/models/db" - "code.gitea.io/gitea/models/foreignreference" issues_model "code.gitea.io/gitea/models/issues" repo_model "code.gitea.io/gitea/models/repo" user_model "code.gitea.io/gitea/models/user" @@ -403,16 +402,6 @@ func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error { Labels: labels, CreatedUnix: timeutil.TimeStamp(issue.Created.Unix()), UpdatedUnix: timeutil.TimeStamp(issue.Updated.Unix()), - ForeignReference: &foreignreference.ForeignReference{ - LocalIndex: issue.GetLocalIndex(), - ForeignIndex: strconv.FormatInt(issue.GetForeignIndex(), 10), - RepoID: g.repo.ID, - Type: foreignreference.TypeIssue, - }, - } - - if is.ForeignReference.ForeignIndex == "0" { - is.ForeignReference.ForeignIndex = strconv.FormatInt(is.Index, 10) } if err := g.remapUser(issue, &is); err != nil { From 2cf0cf0de1fc298f1b44a0452c8dbb2c2f9dd71c Mon Sep 17 00:00:00 2001 From: silverwind Date: Fri, 23 Dec 2022 17:03:11 +0100 Subject: [PATCH 15/17] JS refactors (#22227) - Replace all default exports with named exports, except for Vue SFCs - Remove names from Vue SFCs, they are automatically inferred from the filename - Misc whitespace-related tweaks --- web_src/js/components/ActivityHeatmap.vue | 1 - web_src/js/components/ContextPopup.vue | 10 +-------- web_src/js/components/DiffFileList.vue | 6 ----- web_src/js/components/DiffFileTree.vue | 6 +---- web_src/js/components/DiffFileTreeItem.vue | 7 +----- .../js/components/PullRequestMergeForm.vue | 12 +--------- web_src/js/features/clipboard.js | 2 +- web_src/js/features/colorpicker.js | 2 +- web_src/js/features/common-global.js | 2 +- web_src/js/features/comp/ColorPicker.js | 2 +- web_src/js/features/comp/EasyMDE.js | 2 +- web_src/js/features/comp/SearchUserBox.js | 1 - web_src/js/features/comp/WebHookEditor.js | 1 + web_src/js/features/contextpopup.js | 2 +- web_src/js/features/copycontent.js | 1 + web_src/js/features/dropzone.js | 2 +- web_src/js/features/emoji.js | 3 +-- web_src/js/features/file-fold.js | 1 - web_src/js/features/formatting.js | 1 - web_src/js/features/heatmap.js | 3 ++- web_src/js/features/imagediff.js | 2 +- web_src/js/features/repo-diff-filetree.js | 2 +- web_src/js/features/repo-findfile.js | 2 +- web_src/js/features/repo-graph.js | 2 +- web_src/js/features/repo-issue-pr-form.js | 2 +- web_src/js/features/repo-issue.js | 2 +- web_src/js/features/repo-legacy.js | 21 +++++++----------- web_src/js/features/repo-migration.js | 2 +- web_src/js/features/repo-projects.js | 2 +- web_src/js/features/repo-release.js | 2 +- web_src/js/features/serviceworker.js | 2 +- web_src/js/features/tablesort.js | 2 +- web_src/js/features/tribute.js | 2 +- web_src/js/index.js | 22 +++++++++---------- web_src/js/svg.js | 2 -- 35 files changed, 47 insertions(+), 89 deletions(-) diff --git a/web_src/js/components/ActivityHeatmap.vue b/web_src/js/components/ActivityHeatmap.vue index 6cd72a8bf7..d0f81c586c 100644 --- a/web_src/js/components/ActivityHeatmap.vue +++ b/web_src/js/components/ActivityHeatmap.vue @@ -18,7 +18,6 @@ import {CalendarHeatmap} from 'vue3-calendar-heatmap'; export default { - name: 'ActivityHeatmap', components: {CalendarHeatmap}, props: { values: { diff --git a/web_src/js/components/ContextPopup.vue b/web_src/js/components/ContextPopup.vue index 0b086690a9..07c73ff5cf 100644 --- a/web_src/js/components/ContextPopup.vue +++ b/web_src/js/components/ContextPopup.vue @@ -46,19 +46,13 @@ const luminance = (colorString) => { const luminanceThreshold = 0.179; export default { - name: 'ContextPopup', - - components: { - SvgIcon, - }, - + components: {SvgIcon}, data: () => ({ loading: false, issue: null, i18nErrorOccurred: i18n.error_occurred, i18nErrorMessage: null, }), - computed: { createdAt() { return new Date(this.issue.created_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'}); @@ -107,7 +101,6 @@ export default { }); } }, - mounted() { this.$refs.root.addEventListener('us-load-context-popup', (e) => { const data = e.detail; @@ -116,7 +109,6 @@ export default { } }); }, - methods: { load(data) { this.loading = true; diff --git a/web_src/js/components/DiffFileList.vue b/web_src/js/components/DiffFileList.vue index da53be3b46..f95f28528d 100644 --- a/web_src/js/components/DiffFileList.vue +++ b/web_src/js/components/DiffFileList.vue @@ -27,12 +27,9 @@ import {doLoadMoreFiles} from '../features/repo-diff.js'; const {pageData} = window.config; export default { - name: 'DiffFileList', - data: () => { return pageData.diffFileInfo; }, - watch: { fileListIsVisible(newValue) { if (newValue === true) { @@ -44,15 +41,12 @@ export default { } } }, - mounted() { document.getElementById('show-file-list-btn').addEventListener('click', this.toggleFileList); }, - unmounted() { document.getElementById('show-file-list-btn').removeEventListener('click', this.toggleFileList); }, - methods: { toggleFileList() { this.fileListIsVisible = !this.fileListIsVisible; diff --git a/web_src/js/components/DiffFileTree.vue b/web_src/js/components/DiffFileTree.vue index 717ba70f7f..e592574ac1 100644 --- a/web_src/js/components/DiffFileTree.vue +++ b/web_src/js/components/DiffFileTree.vue @@ -21,15 +21,12 @@ const {pageData} = window.config; const LOCAL_STORAGE_KEY = 'diff_file_tree_visible'; export default { - name: 'DiffFileTree', components: {DiffFileTreeItem}, - data: () => { const fileTreeIsVisible = localStorage.getItem(LOCAL_STORAGE_KEY) === 'true'; pageData.diffFileInfo.fileTreeIsVisible = fileTreeIsVisible; return pageData.diffFileInfo; }, - computed: { fileTree() { const result = []; @@ -94,7 +91,6 @@ export default { return result; } }, - mounted() { // ensure correct buttons when we are mounted to the dom this.adjustToggleButton(this.fileTreeIsVisible); @@ -125,7 +121,7 @@ export default { doLoadMoreFiles(this.link, this.diffEnd, () => { this.isLoadingNewData = false; }); - } + }, }, }; diff --git a/web_src/js/components/DiffFileTreeItem.vue b/web_src/js/components/DiffFileTreeItem.vue index 4f20f1e66a..4089e51410 100644 --- a/web_src/js/components/DiffFileTreeItem.vue +++ b/web_src/js/components/DiffFileTreeItem.vue @@ -43,11 +43,7 @@ import {SvgIcon} from '../svg.js'; export default { - name: 'DiffFileTreeItem', - components: { - SvgIcon, - }, - + components: {SvgIcon}, props: { item: { type: Object, @@ -59,7 +55,6 @@ export default { default: true } }, - data: () => ({ collapsed: false, }), diff --git a/web_src/js/components/PullRequestMergeForm.vue b/web_src/js/components/PullRequestMergeForm.vue index 1fec12dd5a..1e0ebc5a47 100644 --- a/web_src/js/components/PullRequestMergeForm.vue +++ b/web_src/js/components/PullRequestMergeForm.vue @@ -111,11 +111,7 @@ import {SvgIcon} from '../svg.js'; const {csrfToken, pageData} = window.config; export default { - name: 'PullRequestMergeForm', - components: { - SvgIcon, - }, - + components: {SvgIcon}, data: () => ({ csrfToken, mergeForm: pageData.pullRequestMergeForm, @@ -137,20 +133,17 @@ export default { showMergeStyleMenu: false, showActionForm: false, }), - computed: { mergeButtonStyleClass() { if (this.mergeForm.allOverridableChecksOk) return 'green'; return this.autoMergeWhenSucceed ? 'blue' : 'red'; } }, - watch: { mergeStyle(val) { this.mergeStyleDetail = this.mergeForm.mergeStyles.find((e) => e.name === val); } }, - created() { this.mergeStyleAllowedCount = this.mergeForm.mergeStyles.reduce((v, msd) => v + (msd.allowed ? 1 : 0), 0); @@ -158,15 +151,12 @@ export default { if (!mergeStyle) mergeStyle = this.mergeForm.mergeStyles.find((e) => e.allowed)?.name; this.switchMergeStyle(mergeStyle, !this.mergeForm.canMergeNow); }, - mounted() { document.addEventListener('mouseup', this.hideMergeStyleMenu); }, - unmounted() { document.removeEventListener('mouseup', this.hideMergeStyleMenu); }, - methods: { hideMergeStyleMenu() { this.showMergeStyleMenu = false; diff --git a/web_src/js/features/clipboard.js b/web_src/js/features/clipboard.js index 75b96cb781..f8486cdc6c 100644 --- a/web_src/js/features/clipboard.js +++ b/web_src/js/features/clipboard.js @@ -44,7 +44,7 @@ function fallbackCopyToClipboard(text) { // For all DOM elements with [data-clipboard-target] or [data-clipboard-text], // this copy-to-clipboard will work for them -export default function initGlobalCopyToClipboardListener() { +export function initGlobalCopyToClipboardListener() { document.addEventListener('click', (e) => { let target = e.target; // in case , so we just search diff --git a/web_src/js/features/colorpicker.js b/web_src/js/features/colorpicker.js index 11c5f26fa4..a5fdb3f5a6 100644 --- a/web_src/js/features/colorpicker.js +++ b/web_src/js/features/colorpicker.js @@ -1,4 +1,4 @@ -export default async function createColorPicker($els) { +export async function createColorPicker($els) { if (!$els || !$els.length) return; await Promise.all([ diff --git a/web_src/js/features/common-global.js b/web_src/js/features/common-global.js index 7efefd7084..2504f3be0a 100644 --- a/web_src/js/features/common-global.js +++ b/web_src/js/features/common-global.js @@ -1,7 +1,7 @@ import $ from 'jquery'; import 'jquery.are-you-sure'; import {mqBinarySearch} from '../utils.js'; -import createDropzone from './dropzone.js'; +import {createDropzone} from './dropzone.js'; import {initCompColorPicker} from './comp/ColorPicker.js'; import {showGlobalErrorMessage} from '../bootstrap.js'; import {attachDropdownAria} from './aria.js'; diff --git a/web_src/js/features/comp/ColorPicker.js b/web_src/js/features/comp/ColorPicker.js index 053fc6c059..5665b7a24a 100644 --- a/web_src/js/features/comp/ColorPicker.js +++ b/web_src/js/features/comp/ColorPicker.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import createColorPicker from '../colorpicker.js'; +import {createColorPicker} from '../colorpicker.js'; export function initCompColorPicker() { createColorPicker($('.color-picker')); diff --git a/web_src/js/features/comp/EasyMDE.js b/web_src/js/features/comp/EasyMDE.js index 1f7fe45153..182e6b429d 100644 --- a/web_src/js/features/comp/EasyMDE.js +++ b/web_src/js/features/comp/EasyMDE.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import attachTribute from '../tribute.js'; +import {attachTribute} from '../tribute.js'; import {handleGlobalEnterQuickSubmit} from './QuickSubmit.js'; /** diff --git a/web_src/js/features/comp/SearchUserBox.js b/web_src/js/features/comp/SearchUserBox.js index 46ecb8ebf4..0e9a005acf 100644 --- a/web_src/js/features/comp/SearchUserBox.js +++ b/web_src/js/features/comp/SearchUserBox.js @@ -2,7 +2,6 @@ import $ from 'jquery'; import {htmlEscape} from 'escape-goat'; const {appSubUrl} = window.config; - const looksLikeEmailAddressCheck = /^\S+@\S+$/; export function initCompSearchUserBox() { diff --git a/web_src/js/features/comp/WebHookEditor.js b/web_src/js/features/comp/WebHookEditor.js index 85a4f92809..cda0fa3910 100644 --- a/web_src/js/features/comp/WebHookEditor.js +++ b/web_src/js/features/comp/WebHookEditor.js @@ -1,4 +1,5 @@ import $ from 'jquery'; + const {csrfToken} = window.config; export function initCompWebHookEditor() { diff --git a/web_src/js/features/contextpopup.js b/web_src/js/features/contextpopup.js index d29da6d951..61f7120908 100644 --- a/web_src/js/features/contextpopup.js +++ b/web_src/js/features/contextpopup.js @@ -4,7 +4,7 @@ import ContextPopup from '../components/ContextPopup.vue'; import {parseIssueHref} from '../utils.js'; import {createTippy} from '../modules/tippy.js'; -export default function initContextPopups() { +export function initContextPopups() { const refIssues = $('.ref-issue'); if (!refIssues.length) return; diff --git a/web_src/js/features/copycontent.js b/web_src/js/features/copycontent.js index 9b791bedba..5a4b99ae9b 100644 --- a/web_src/js/features/copycontent.js +++ b/web_src/js/features/copycontent.js @@ -1,6 +1,7 @@ import {copyToClipboard} from './clipboard.js'; import {showTemporaryTooltip} from '../modules/tippy.js'; import {convertImage} from '../utils.js'; + const {i18n} = window.config; async function doCopy(content, btn) { diff --git a/web_src/js/features/dropzone.js b/web_src/js/features/dropzone.js index 1c80fb778c..e7b8a9dde9 100644 --- a/web_src/js/features/dropzone.js +++ b/web_src/js/features/dropzone.js @@ -1,4 +1,4 @@ -export default async function createDropzone(el, opts) { +export async function createDropzone(el, opts) { const [{Dropzone}] = await Promise.all([ import(/* webpackChunkName: "dropzone" */'dropzone'), import(/* webpackChunkName: "dropzone" */'dropzone/dist/dropzone.css'), diff --git a/web_src/js/features/emoji.js b/web_src/js/features/emoji.js index 304c564f3d..d00ff65456 100644 --- a/web_src/js/features/emoji.js +++ b/web_src/js/features/emoji.js @@ -1,7 +1,6 @@ import emojis from '../../../assets/emoji.json'; -const {assetUrlPrefix} = window.config; -const {customEmojis} = window.config; +const {assetUrlPrefix, customEmojis} = window.config; const tempMap = {...customEmojis}; for (const {emoji, aliases} of emojis) { diff --git a/web_src/js/features/file-fold.js b/web_src/js/features/file-fold.js index 5e714a1de8..0d5be7cf60 100644 --- a/web_src/js/features/file-fold.js +++ b/web_src/js/features/file-fold.js @@ -1,6 +1,5 @@ import {svg} from '../svg.js'; - // Hides the file if newFold is true, and shows it otherwise. The actual hiding is performed using CSS. // // The fold arrow is the icon displayed on the upper left of the file box, especially intended for components having the 'fold-file' class. diff --git a/web_src/js/features/formatting.js b/web_src/js/features/formatting.js index c8f5db9e14..837e323376 100644 --- a/web_src/js/features/formatting.js +++ b/web_src/js/features/formatting.js @@ -1,7 +1,6 @@ import {prettyNumber} from '../utils.js'; const {lang} = document.documentElement; - const dateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'long', day: 'numeric'}); const shortDateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric'}); const dateTimeFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'}); diff --git a/web_src/js/features/heatmap.js b/web_src/js/features/heatmap.js index 368ddd0d77..f80089ee43 100644 --- a/web_src/js/features/heatmap.js +++ b/web_src/js/features/heatmap.js @@ -1,7 +1,8 @@ import {createApp} from 'vue'; import ActivityHeatmap from '../components/ActivityHeatmap.vue'; import {translateMonth, translateDay} from '../utils.js'; -export default function initHeatmap() { + +export function initHeatmap() { const el = document.getElementById('user-heatmap'); if (!el) return; diff --git a/web_src/js/features/imagediff.js b/web_src/js/features/imagediff.js index 0b021d070f..03ae3b047b 100644 --- a/web_src/js/features/imagediff.js +++ b/web_src/js/features/imagediff.js @@ -34,7 +34,7 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) { return null; } -export default function initImageDiff() { +export function initImageDiff() { function createContext(image1, image2) { const size1 = { width: image1 && image1.width || 0, diff --git a/web_src/js/features/repo-diff-filetree.js b/web_src/js/features/repo-diff-filetree.js index 6059dd82e7..5dd2c42e74 100644 --- a/web_src/js/features/repo-diff-filetree.js +++ b/web_src/js/features/repo-diff-filetree.js @@ -2,7 +2,7 @@ import {createApp} from 'vue'; import DiffFileTree from '../components/DiffFileTree.vue'; import DiffFileList from '../components/DiffFileList.vue'; -export default function initDiffFileTree() { +export function initDiffFileTree() { const el = document.getElementById('diff-file-tree'); if (!el) return; diff --git a/web_src/js/features/repo-findfile.js b/web_src/js/features/repo-findfile.js index 750b906cef..7b8833e793 100644 --- a/web_src/js/features/repo-findfile.js +++ b/web_src/js/features/repo-findfile.js @@ -1,6 +1,6 @@ import $ from 'jquery'; - import {svg} from '../svg.js'; + const {csrf} = window.config; const threshold = 50; diff --git a/web_src/js/features/repo-graph.js b/web_src/js/features/repo-graph.js index f27a986621..16d35e66f2 100644 --- a/web_src/js/features/repo-graph.js +++ b/web_src/js/features/repo-graph.js @@ -1,6 +1,6 @@ import $ from 'jquery'; -export default function initRepoGraphGit() { +export function initRepoGraphGit() { const graphContainer = document.getElementById('git-graph-container'); if (!graphContainer) return; diff --git a/web_src/js/features/repo-issue-pr-form.js b/web_src/js/features/repo-issue-pr-form.js index 59d4c7a3b4..7b26e643c0 100644 --- a/web_src/js/features/repo-issue-pr-form.js +++ b/web_src/js/features/repo-issue-pr-form.js @@ -1,7 +1,7 @@ import {createApp} from 'vue'; import PullRequestMergeForm from '../components/PullRequestMergeForm.vue'; -export default function initPullRequestMergeForm() { +export function initRepoPullRequestMergeForm() { const el = document.getElementById('pull-request-merge-form'); if (!el) return; diff --git a/web_src/js/features/repo-issue.js b/web_src/js/features/repo-issue.js index ca5d69c5a6..56d294e81a 100644 --- a/web_src/js/features/repo-issue.js +++ b/web_src/js/features/repo-issue.js @@ -1,6 +1,6 @@ import $ from 'jquery'; import {htmlEscape} from 'escape-goat'; -import attachTribute from './tribute.js'; +import {attachTribute} from './tribute.js'; import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; diff --git a/web_src/js/features/repo-legacy.js b/web_src/js/features/repo-legacy.js index 910d4bb56c..37366578e2 100644 --- a/web_src/js/features/repo-legacy.js +++ b/web_src/js/features/repo-legacy.js @@ -3,33 +3,28 @@ import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import { - initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, - initRepoIssueCommentDelete, - initRepoIssueComments, initRepoIssueDependencyDelete, - initRepoIssueReferenceIssue, initRepoIssueStatusButton, - initRepoIssueTitleEdit, - initRepoIssueWipToggle, initRepoPullRequestUpdate, - updateIssuesMeta, + initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete, + initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue, + initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle, + initRepoPullRequestUpdate, updateIssuesMeta, } from './repo-issue.js'; import {initUnicodeEscapeButton} from './repo-unicode-escape.js'; import {svg} from '../svg.js'; import {htmlEscape} from 'escape-goat'; import {initRepoBranchTagDropdown} from '../components/RepoBranchTagDropdown.js'; import { - initRepoCloneLink, - initRepoCommonBranchOrTagDropdown, - initRepoCommonFilterSearchDropdown, + initRepoCloneLink, initRepoCommonBranchOrTagDropdown, initRepoCommonFilterSearchDropdown, initRepoCommonLanguageStats, } from './repo-common.js'; import {initCitationFileCopyContent} from './citation.js'; import {initCompLabelEdit} from './comp/LabelEdit.js'; import {initRepoDiffConversationNav} from './repo-diff.js'; -import attachTribute from './tribute.js'; -import createDropzone from './dropzone.js'; +import {attachTribute} from './tribute.js'; +import {createDropzone} from './dropzone.js'; import {initCommentContent, initMarkupContent} from '../markup/content.js'; import {initCompReactionSelector} from './comp/ReactionSelector.js'; import {initRepoSettingBranches} from './repo-settings.js'; -import initRepoPullRequestMergeForm from './repo-issue-pr-form.js'; +import {initRepoPullRequestMergeForm} from './repo-issue-pr-form.js'; const {csrfToken} = window.config; diff --git a/web_src/js/features/repo-migration.js b/web_src/js/features/repo-migration.js index ece01e53bd..c317c7245c 100644 --- a/web_src/js/features/repo-migration.js +++ b/web_src/js/features/repo-migration.js @@ -10,7 +10,7 @@ const $lfsSettings = $('#lfs_settings'); const $lfsEndpoint = $('#lfs_endpoint'); const $items = $('#migrate_items').find('input[type=checkbox]'); -export default function initRepoMigration() { +export function initRepoMigration() { checkAuth(); setLFSSettingsVisibility(); diff --git a/web_src/js/features/repo-projects.js b/web_src/js/features/repo-projects.js index b5a720c9d7..f6d6c89816 100644 --- a/web_src/js/features/repo-projects.js +++ b/web_src/js/features/repo-projects.js @@ -84,7 +84,7 @@ async function initRepoProjectSortable() { } } -export default function initRepoProject() { +export function initRepoProject() { if (!$('.repository.projects').length) { return; } diff --git a/web_src/js/features/repo-release.js b/web_src/js/features/repo-release.js index b68a7a6cd5..e84cc53d17 100644 --- a/web_src/js/features/repo-release.js +++ b/web_src/js/features/repo-release.js @@ -1,5 +1,5 @@ import $ from 'jquery'; -import attachTribute from './tribute.js'; +import {attachTribute} from './tribute.js'; import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js'; import {initEasyMDEImagePaste} from './comp/ImagePaste.js'; import {createCommentEasyMDE} from './comp/EasyMDE.js'; diff --git a/web_src/js/features/serviceworker.js b/web_src/js/features/serviceworker.js index a072811b04..32d2e04cd6 100644 --- a/web_src/js/features/serviceworker.js +++ b/web_src/js/features/serviceworker.js @@ -35,7 +35,7 @@ async function checkCacheValidity() { } } -export default async function initServiceWorker() { +export async function initServiceWorker() { if (!('serviceWorker' in navigator)) return; if (useServiceWorker) { diff --git a/web_src/js/features/tablesort.js b/web_src/js/features/tablesort.js index 1fc2a4bd56..436fe0a594 100644 --- a/web_src/js/features/tablesort.js +++ b/web_src/js/features/tablesort.js @@ -1,4 +1,4 @@ -export default function initTableSort() { +export function initTableSort() { for (const header of document.querySelectorAll('th[data-sortt-asc]') || []) { const sorttAsc = header.getAttribute('data-sortt-asc'); const sorttDesc = header.getAttribute('data-sortt-desc'); diff --git a/web_src/js/features/tribute.js b/web_src/js/features/tribute.js index dcee7aa4a3..94f3512a2e 100644 --- a/web_src/js/features/tribute.js +++ b/web_src/js/features/tribute.js @@ -49,7 +49,7 @@ function makeCollections({mentions, emoji}) { return collections; } -export default async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) { +export async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) { if (!window.config.requireTribute || !elementOrNodeList) return; const nodes = Array.from('length' in elementOrNodeList ? elementOrNodeList : [elementOrNodeList]); if (!nodes.length) return; diff --git a/web_src/js/index.js b/web_src/js/index.js index f4638a60e0..a866184203 100644 --- a/web_src/js/index.js +++ b/web_src/js/index.js @@ -6,16 +6,16 @@ import {initVueEnv} from './components/VueComponentLoader.js'; import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue'; import {initDashboardRepoList} from './components/DashboardRepoList.js'; -import attachTribute from './features/tribute.js'; -import initGlobalCopyToClipboardListener from './features/clipboard.js'; -import initContextPopups from './features/contextpopup.js'; -import initRepoGraphGit from './features/repo-graph.js'; -import initHeatmap from './features/heatmap.js'; -import initImageDiff from './features/imagediff.js'; -import initRepoMigration from './features/repo-migration.js'; -import initRepoProject from './features/repo-projects.js'; -import initServiceWorker from './features/serviceworker.js'; -import initTableSort from './features/tablesort.js'; +import {attachTribute} from './features/tribute.js'; +import {initGlobalCopyToClipboardListener} from './features/clipboard.js'; +import {initContextPopups} from './features/contextpopup.js'; +import {initRepoGraphGit} from './features/repo-graph.js'; +import {initHeatmap} from './features/heatmap.js'; +import {initImageDiff} from './features/imagediff.js'; +import {initRepoMigration} from './features/repo-migration.js'; +import {initRepoProject} from './features/repo-projects.js'; +import {initServiceWorker} from './features/serviceworker.js'; +import {initTableSort} from './features/tablesort.js'; import {initAdminUserListSearchForm} from './features/admin/users.js'; import {initAdminConfigs} from './features/admin/config.js'; import {initMarkupAnchors} from './markup/anchors.js'; @@ -24,7 +24,7 @@ import {initRepoIssueContentHistory} from './features/repo-issue-content.js'; import {initStopwatch} from './features/stopwatch.js'; import {initFindFileInRepo} from './features/repo-findfile.js'; import {initCommentContent, initMarkupContent} from './markup/content.js'; -import initDiffFileTree from './features/repo-diff-filetree.js'; +import {initDiffFileTree} from './features/repo-diff-filetree.js'; import {initUserAuthLinkAccountView, initUserAuthOauth2} from './features/user-auth.js'; import { diff --git a/web_src/js/svg.js b/web_src/js/svg.js index 60dd49f8bf..0f08f64e80 100644 --- a/web_src/js/svg.js +++ b/web_src/js/svg.js @@ -26,7 +26,6 @@ import octiconSidebarExpand from '../../public/img/svg/octicon-sidebar-expand.sv import octiconTriangleDown from '../../public/img/svg/octicon-triangle-down.svg'; import octiconX from '../../public/img/svg/octicon-x.svg'; - export const svgs = { 'octicon-chevron-down': octiconChevronDown, 'octicon-chevron-right': octiconChevronRight, @@ -57,7 +56,6 @@ export const svgs = { 'octicon-x': octiconX, }; - const parser = new DOMParser(); const serializer = new XMLSerializer(); From 2b0b56319e94b7173b566af4d082f03664853789 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sat, 24 Dec 2022 02:34:51 +0800 Subject: [PATCH 16/17] Improve testing for pgsql empty repository (#22223) --- tests/integration/empty_repo_test.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/integration/empty_repo_test.go b/tests/integration/empty_repo_test.go index 4bc1d811bf..1a83de1292 100644 --- a/tests/integration/empty_repo_test.go +++ b/tests/integration/empty_repo_test.go @@ -11,6 +11,8 @@ import ( "code.gitea.io/gitea/models/unittest" user_model "code.gitea.io/gitea/models/user" "code.gitea.io/gitea/tests" + + "github.com/stretchr/testify/assert" ) func TestEmptyRepo(t *testing.T) { @@ -21,7 +23,8 @@ func TestEmptyRepo(t *testing.T) { "commit/1ae57b34ccf7e18373", "graph", } - emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{}, unittest.Cond("is_empty = ?", true)) + emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 5}) + assert.True(t, emptyRepo.IsEmpty) owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: emptyRepo.OwnerID}) for _, subpath := range subpaths { req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath) From 3bd49f780157494a3ff923a3bcdbb8696a688173 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Sun, 25 Dec 2022 00:19:36 +0000 Subject: [PATCH 17/17] [skip ci] Updated licenses and gitignores --- options/gitignore/Godot | 4 ++++ options/license/Bitstream-Charter | 9 ++++++++ options/license/Graphics-Gems | 5 +++++ options/license/IJG-short | 35 +++++++++++++++++++++++++++++++ options/license/MIT-Wu | 28 +++++++++++++++++++++++++ options/license/TPDL | 2 ++ options/license/TTWL | 8 +++++++ 7 files changed, 91 insertions(+) create mode 100644 options/license/Bitstream-Charter create mode 100644 options/license/Graphics-Gems create mode 100644 options/license/IJG-short create mode 100644 options/license/MIT-Wu create mode 100644 options/license/TPDL create mode 100644 options/license/TTWL diff --git a/options/gitignore/Godot b/options/gitignore/Godot index 4f48ad79f8..d9aac213e7 100644 --- a/options/gitignore/Godot +++ b/options/gitignore/Godot @@ -1,3 +1,6 @@ +# Godot 4+ specific ignores +.godot/ + # Godot-specific ignores .import/ export.cfg @@ -9,3 +12,4 @@ export_presets.cfg # Mono-specific ignores .mono/ data_*/ +mono_crash.*.json diff --git a/options/license/Bitstream-Charter b/options/license/Bitstream-Charter new file mode 100644 index 0000000000..7a0cf97a0c --- /dev/null +++ b/options/license/Bitstream-Charter @@ -0,0 +1,9 @@ +(c) Copyright 1989-1992, Bitstream Inc., Cambridge, MA. + +You are hereby granted permission under all Bitstream propriety rights +to use, copy, modify, sublicense, sell, and redistribute the 4 Bitstream +Charter (r) Type 1 outline fonts and the 4 Courier Type 1 outline fonts for +any purpose and without restriction; provided, that this notice is left +intact on all copies of such fonts and that Bitstream's trademark is acknowledged +as shown below on all unmodified copies of the 4 Charter Type 1 fonts. +BITSTREAM CHARTER is a registered trademark of Bitstream Inc. diff --git a/options/license/Graphics-Gems b/options/license/Graphics-Gems new file mode 100644 index 0000000000..ec28c46563 --- /dev/null +++ b/options/license/Graphics-Gems @@ -0,0 +1,5 @@ +LICENSE + +This code repository predates the concept of Open Source, and predates most licenses along such lines. As such, the official license truly is: + +EULA: The Graphics Gems code is copyright-protected. In other words, you cannot claim the text of the code as your own and resell it. Using the code is permitted in any program, product, or library, non-commercial or commercial. Giving credit is not required, though is a nice gesture. The code comes as-is, and if there are any flaws or problems with any Gems code, nobody involved with Gems - authors, editors, publishers, or webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes with no guarantee. diff --git a/options/license/IJG-short b/options/license/IJG-short new file mode 100644 index 0000000000..bbb0859d80 --- /dev/null +++ b/options/license/IJG-short @@ -0,0 +1,35 @@ +The authors make NO WARRANTY or representation, either express or +implied, with respect to this software, its quality, accuracy, +merchantability, or fitness for a particular purpose. This software is +provided "AS IS", and you, its user, assume the entire risk as to its +quality and accuracy. + +This software is copyright (C) 1991, 1992, Thomas G. Lane. All Rights +Reserved except as specified below. + +Permission is hereby granted to use, copy, modify, and distribute this +software (or portions thereof) for any purpose, without fee, subject to +these conditions: + +(1) If any part of the source code for this software +is distributed, then this README file must be included, with this +copyright and no-warranty notice unaltered; and any additions, +deletions, or changes to the original files must be clearly indicated +in accompanying documentation. + +(2) If only executable code is +distributed, then the accompanying documentation must state that "this +software is based in part on the work of the Independent JPEG Group". + +(3) Permission for use of this software is granted only if the user +accepts full responsibility for any undesirable consequences; the +authors accept NO LIABILITY for damages of any kind. + +Permission is NOT granted for the use of any IJG author's name or +company name in advertising or publicity relating to this software or +products derived from it. This software may be referred to only as +"the Independent JPEG Group's software". + +We specifically permit and encourage the use of this software as the +basis of commercial products, provided that all warranty or liability +claims are assumed by the product vendor. diff --git a/options/license/MIT-Wu b/options/license/MIT-Wu new file mode 100644 index 0000000000..86eec3c517 --- /dev/null +++ b/options/license/MIT-Wu @@ -0,0 +1,28 @@ +Copyright (c) 2003-2005 Tom Wu +All Rights Reserved. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, +EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY +WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + +IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, +INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER +RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF +THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT +OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + +In addition, the following condition applies: + +All redistributions must retain an intact copy of this copyright notice +and disclaimer. diff --git a/options/license/TPDL b/options/license/TPDL new file mode 100644 index 0000000000..d950f8f19e --- /dev/null +++ b/options/license/TPDL @@ -0,0 +1,2 @@ +Copyright (C) 1996-2010 David Muir Sharnoff. Copyright (C) 2011 Google, Inc. +License hereby granted for anyone to use, modify or redistribute this module at their own risk. Please feed useful changes back to cpan@dave.sharnoff.org. diff --git a/options/license/TTWL b/options/license/TTWL new file mode 100644 index 0000000000..c13d3fbe04 --- /dev/null +++ b/options/license/TTWL @@ -0,0 +1,8 @@ +Copyright (C) 1996-2002,2005,2006 David Muir Sharnoff. +Copyright (C) 2005 Aristotle Pagaltzis +Copyright (C) 2012-2013 Google, Inc. + +This module may be modified, used, copied, and redistributed at your own risk. +Although allowed by the preceding license, please do not publicly +redistribute modified versions of this code with the name "Text::Tabs" +unless it passes the unmodified Text::Tabs test suite.