]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agocode.gitea.io/sdk/gitea v0.14.0 -> v0.15.1 (#18186)
6543 [Wed, 5 Jan 2022 04:51:12 +0000 (05:51 +0100)]
code.gitea.io/sdk/gitea v0.14.0 -> v0.15.1 (#18186)

2 years agoTeam permission allow different unit has different permission (#17811)
Lunny Xiao [Wed, 5 Jan 2022 03:37:00 +0000 (11:37 +0800)]
Team permission allow different unit has different permission (#17811)

* Team permission allow different unit has different permission

* Finish the interface and the logic

* Fix lint

* Fix translation

* align center for table cell content

* Fix fixture

* merge

* Fix test

* Add deprecated

* Improve code

* Add tooltip

* Fix swagger

* Fix newline

* Fix tests

* Fix tests

* Fix test

* Fix test

* Max permission of external wiki and issues should be read

* Move team units with limited max level below units table

* Update label and column names

* Some improvements

* Fix lint

* Some improvements

* Fix template variables

* Add permission docs

* improve doc

* Fix fixture

* Fix bug

* Fix some bug

* fix

* gofumpt

* Integration test for migration (#18124)

integrations: basic test for Gitea {dump,restore}-repo
This is a first step for integration testing of DumpRepository and
RestoreRepository. It:

runs a Gitea server,
dumps a repo via DumpRepository to the filesystem,
restores the repo via RestoreRepository from the filesystem,
dumps the restored repository to the filesystem,
compares the first and second dump and expects them to be identical

The verification is trivial and the goal is to add more tests for each
topic of the dump.

Signed-off-by: Loïc Dachary <loic@dachary.org>
* Team permission allow different unit has different permission

* Finish the interface and the logic

* Fix lint

* Fix translation

* align center for table cell content

* Fix fixture

* merge

* Fix test

* Add deprecated

* Improve code

* Add tooltip

* Fix swagger

* Fix newline

* Fix tests

* Fix tests

* Fix test

* Fix test

* Max permission of external wiki and issues should be read

* Move team units with limited max level below units table

* Update label and column names

* Some improvements

* Fix lint

* Some improvements

* Fix template variables

* Add permission docs

* improve doc

* Fix fixture

* Fix bug

* Fix some bug

* Fix bug

Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Aravinth Manivannan <realaravinth@batsense.net>
2 years agoIntegration test for migration (#18124)
Aravinth Manivannan [Tue, 4 Jan 2022 19:24:27 +0000 (19:24 +0000)]
Integration test for migration (#18124)

integrations: basic test for Gitea {dump,restore}-repo
This is a first step for integration testing of DumpRepository and
RestoreRepository. It:

runs a Gitea server,
dumps a repo via DumpRepository to the filesystem,
restores the repo via RestoreRepository from the filesystem,
dumps the restored repository to the filesystem,
compares the first and second dump and expects them to be identical

The verification is trivial and the goal is to add more tests for each
topic of the dump.

Signed-off-by: Loïc Dachary <loic@dachary.org>
2 years agoUpdate `TODOs` badge to reflect new default branch (#18182)
Patrick DeVivo [Tue, 4 Jan 2022 16:46:32 +0000 (11:46 -0500)]
Update `TODOs` badge to reflect new default branch (#18182)

* Update `TODOs` badge to reflect `main` as default branch

* update `README_ZH.md` as well

2 years agoIncrease Salt randomness (#18179)
Gusted [Tue, 4 Jan 2022 15:13:52 +0000 (15:13 +0000)]
Increase Salt randomness  (#18179)

- The current implementation of `RandomString` doesn't give you a most-possible unique randomness. It gives you 6*`length` instead of the possible 8*`length` bits(or as `length`x bytes) randomness. This is because `RandomString` is being limited to a max value of 63, this in order to represent the random byte as a letter/digit.
- The recommendation of pbkdf2 is to use 64+ bit salt, which the `RandomString` doesn't give with a length of 10, instead of increasing 10 to a higher number, this patch adds a new function called `RandomBytes` which does give you the guarentee of 8*`length` randomness and thus corresponding of `length`x bytes randomness.
- Use hexadecimal to store the bytes value in the database, as mentioned, it doesn't play nice in order to convert it to a string. This will always be a length of 32(with `length` being 16).
- When we detect on `Authenticate`(source: db) that a user has the old format of salt, re-hash the password such that the user will have it's password hashed with increased salt.

Thanks to @zeripath for working out the rouge edges from my first commit 😄.

Co-authored-by: lafriks <lauris@nix.lv>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoAdd MP4 as default allowed attachment type (#18170)
Gusted [Tue, 4 Jan 2022 03:36:47 +0000 (03:36 +0000)]
Add MP4 as default allowed attachment type (#18170)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 4 Jan 2022 00:28:34 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoInclude folders into size cost (#18158)
Gusted [Mon, 3 Jan 2022 23:24:12 +0000 (23:24 +0000)]
Include folders into size cost (#18158)

- Include folders for the disk consumption size, they should be included
as they are also saved on the disk :)
- Have a more accurate picture of the size of a repo.
- Mostly they are the size of the file system's block size. E.g. 4Kb on
Linux.

2 years agoDon't delete branch if other PRs with this branch are open (#18164)
a1012112796 [Mon, 3 Jan 2022 19:45:58 +0000 (03:45 +0800)]
Don't delete branch if other PRs with this branch are open (#18164)

fix #18149

Signed-off-by: a1012112796 <1012112796@qq.com>
2 years agoRemove unused route "/tasks/trigger" (#18160)
Gusted [Mon, 3 Jan 2022 17:23:43 +0000 (17:23 +0000)]
Remove unused route "/tasks/trigger" (#18160)

ref: https://github.com/go-gitea/gitea/pull/18160#issuecomment-1004091325

2 years agoFix EasyMDE validation (#18161)
wxiaoguang [Mon, 3 Jan 2022 16:53:53 +0000 (00:53 +0800)]
Fix EasyMDE validation (#18161)

2 years agoFix bug (#18168)
Lunny Xiao [Mon, 3 Jan 2022 16:06:46 +0000 (00:06 +0800)]
Fix bug (#18168)

2 years agotests: add coverage for models migration helpers (#18162)
Aravinth Manivannan [Mon, 3 Jan 2022 15:35:01 +0000 (15:35 +0000)]
tests: add coverage for models migration helpers  (#18162)

They were previously not covered at all, either by integration tests or unit tests.

This PR also fixes a bug where the `num_comments` field was incorrectly set to include all types of comments.

It sets num_closed_issues: 0 as default in milestone unit test fixtures. If they are not set, Incr("num_closed_issues") will be a noop because the field is null.

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 3 Jan 2022 00:28:34 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRequire codereview to have content (#18156)
Gusted [Sun, 2 Jan 2022 22:31:03 +0000 (22:31 +0000)]
Require codereview to have content (#18156)

- Report a validityError when the codeReview have no comment.
- Resolves #18151
- Refactor

2 years agochore(lint): use golangci-lint to call revive and misspell checker. (#18145)
Bo-Yi Wu [Sun, 2 Jan 2022 19:30:40 +0000 (03:30 +0800)]
chore(lint): use golangci-lint to call revive and misspell checker. (#18145)

replace revive and misspell with golangci-lint

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
2 years agoUpdate owners for 2022 (#18155)
6543 [Sun, 2 Jan 2022 16:54:49 +0000 (17:54 +0100)]
Update owners for 2022 (#18155)

2 years agoRefactor auth package (#17962)
Lunny Xiao [Sun, 2 Jan 2022 13:12:35 +0000 (21:12 +0800)]
Refactor auth package (#17962)

2 years agoUnify and simplify TrN for i18n (#18141)
wxiaoguang [Sun, 2 Jan 2022 03:33:57 +0000 (11:33 +0800)]
Unify and simplify TrN for i18n (#18141)

Refer: https://github.com/go-gitea/gitea/pull/18135#issuecomment-1003246099

Now we have a unique and simple `TrN`, and make the fix of PR #18135 also use the better `TrN` logic.

2 years agoUse correct user when determining max repo limits for error messages (#18153)
Gusted [Sun, 2 Jan 2022 02:38:07 +0000 (02:38 +0000)]
Use correct user when determining max repo limits for error messages (#18153)

- Use the correct user(`owner` instead of `ctx.User`) to get the maxCreationLimit.

2 years agoAdd singuliere to MAINTAINERS (#18148)
singuliere [Sun, 2 Jan 2022 01:12:13 +0000 (02:12 +0100)]
Add singuliere to MAINTAINERS (#18148)

Signed-off-by: singuliere <singuliere@autistici.org>
2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 2 Jan 2022 00:28:42 +0000 (00:28 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoAdd API to get issue/pull comments and events (timeline) (#17403)
qwerty287 [Sat, 1 Jan 2022 14:12:25 +0000 (15:12 +0100)]
Add API to get issue/pull comments and events (timeline) (#17403)

* Add API to get issue/pull comments and events (timeline)
Adds an API to get both comments and events in one endpoint with all required data.
Closes go-gitea/gitea#13250

* Fix swagger

* Don't show code comments (use review api instead)

* fmt

* Fix comment

* Time -> TrackedTime

* Use var directly

* Add logger

* Fix lint

* Fix test

* Add comments

* fmt

* [test] get issue directly by ID

* Update test

* Add description for changed refs

* Fix build issues + lint

* Fix build

* Use string enums

* Update swagger

* Support `page` and `limit` params

* fmt + swagger

* Use global slices

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoUpgrade certmagic from v0.14.1 to v0.15.2 (#18138)
Lunny Xiao [Sat, 1 Jan 2022 09:43:44 +0000 (17:43 +0800)]
Upgrade certmagic from v0.14.1 to v0.15.2 (#18138)

2 years agoUpgrade certmagic from v0.14.1 to v0.15.2 (#18138)
Lunny Xiao [Sat, 1 Jan 2022 09:43:28 +0000 (17:43 +0800)]
Upgrade certmagic from v0.14.1 to v0.15.2 (#18138)

2 years agoAllow admin to associate missing LFS objects for repositories (#18143)
wxiaoguang [Sat, 1 Jan 2022 09:05:31 +0000 (17:05 +0800)]
Allow admin to associate missing LFS objects for repositories (#18143)

This PR reworked the Find pointer files feature in Settings -> LFS page.

When a LFS object is missing from database but exists in LFS content store, admin can associate it to the repository by clicking the Associate button.

This PR is not perfect (because the LFS module itself should be improved too), it's just a nice-to-have feature to help users recover their LFS repositories (eg: database was lost / table was truncated)

2 years agoUpgrade bleve from v2.0.6 to v2.3.0 (#18132)
Lunny Xiao [Sat, 1 Jan 2022 08:26:27 +0000 (16:26 +0800)]
Upgrade bleve from v2.0.6 to v2.3.0 (#18132)

2 years agotests: s/GITEA_UNIT_TESTS_VERBOSE/GITEA_UNIT_TESTS_LOG_SQL/ (#18142)
singuliere [Sat, 1 Jan 2022 03:31:24 +0000 (04:31 +0100)]
tests: s/GITEA_UNIT_TESTS_VERBOSE/GITEA_UNIT_TESTS_LOG_SQL/ (#18142)

The GITEA_UNIT_TESTS_VERBOSE variable is an undocumented variable
introduced in 2017 (see 1028ef2defd94a64f2433b07fe5d93681864cebb)
whose sole purpose has been to log SQL statements when running unit
tests.

It is renamed for clarity and a warning is displayed for backward
compatibility for people and scripts that know about it.

The documentation is updated to reflect this change.

2 years agoservices/repository: fix ListUnadoptedRepositories incorrect total count (#17865)
singuliere [Sat, 1 Jan 2022 02:52:00 +0000 (03:52 +0100)]
services/repository: fix ListUnadoptedRepositories incorrect total count (#17865)

The total count returned by ListUnadoptedRepositories is incorrectly
calculated.

The code snippet within ListUnadoptedRepositories used to verify
unadopted repositories is repeated three times in the function. It is
moved in the checkUnadoptedRepositories function and a unit test is
added to verify it works as expected.

A unit test is added to verify the total count returned by
ListUnadoptedRepositories is as expected.

Signed-off-by: singuliere <singuliere@autistici.org>
2 years agoImprove document for developers: Windows CGO, unit test option (#18140)
wxiaoguang [Fri, 31 Dec 2021 14:21:11 +0000 (22:21 +0800)]
Improve document for developers: Windows CGO, unit test option (#18140)

2 years agoReset the conflicted files list in testpatch (#18139)
zeripath [Fri, 31 Dec 2021 12:33:55 +0000 (12:33 +0000)]
Reset the conflicted files list in testpatch (#18139)

Although #18004 will seriously reduce the likelihood of finding
conflicts in the first place - one bug was introduced whereby the
conflicted files status was not being reset properly. This leads to
conflicted PRs remaining conflicted when the conflict has been resolved.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoUse correct translation key (#18135)
Gusted [Fri, 31 Dec 2021 08:43:03 +0000 (08:43 +0000)]
Use correct translation key (#18135)

- Resolves #18122

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Fri, 31 Dec 2021 00:28:31 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[Frontport] Changelog v1.15.9 (#18136)
6543 [Thu, 30 Dec 2021 17:54:46 +0000 (18:54 +0100)]
[Frontport] Changelog v1.15.9 (#18136)

* Changelog ## [1.15.9](https://github.com/go-gitea/gitea/releases/tag/v1.15.9) - 2021-12-30

* docs: bump version

2 years agoFix wrong redirect on org labels (#18128)
KN4CK3R [Thu, 30 Dec 2021 06:44:42 +0000 (07:44 +0100)]
Fix wrong redirect on org labels (#18128)

2 years agoFix performance regression when user has many organization (#18125)
Lunny Xiao [Thu, 30 Dec 2021 05:03:40 +0000 (13:03 +0800)]
Fix performance regression when user has many organization (#18125)

2 years agodocs: add various ways to install from package (#18120)
Tony [Thu, 30 Dec 2021 04:28:56 +0000 (12:28 +0800)]
docs: add various ways to install from package (#18120)

zh-cn

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRemoved unused method. (#18129)
KN4CK3R [Thu, 30 Dec 2021 03:56:12 +0000 (04:56 +0100)]
Removed unused method. (#18129)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 30 Dec 2021 00:28:34 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRemoved unused endpoint. (#18127)
KN4CK3R [Wed, 29 Dec 2021 22:57:30 +0000 (23:57 +0100)]
Removed unused endpoint. (#18127)

2 years agoUse conditions but not repo ids as query condition (#16839)
Lunny Xiao [Wed, 29 Dec 2021 13:02:12 +0000 (21:02 +0800)]
Use conditions but not repo ids as query condition (#16839)

* Use conditions but not repo ids as query condition

* Improve the performance of pulls/issue

* Remove duplicated code

* fix lint

* Fix bug

* Fix stats

* More fixes

* Fix build

* Fix lint

* Fix test

* Fix build

* Adjust the logic

* Merge

* Fix conflicts

* improve the performance

* Add comments for the query conditions functions

* Some improvements

2 years agoSet HeadCommit when creating tags. (#18116)
KN4CK3R [Wed, 29 Dec 2021 11:40:57 +0000 (12:40 +0100)]
Set HeadCommit when creating tags. (#18116)

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoFix: unstable sort skips/duplicates issues across pages (#18094)
DuckDuckWhale [Wed, 29 Dec 2021 03:12:19 +0000 (19:12 -0800)]
Fix: unstable sort skips/duplicates issues across pages (#18094)

When viewing issues in sorted order, some issues are duplicated across
pages and some are missing.  This is caused by the lack of tie-breakers
in database queries, making pagination inconsistent.

2 years agoHandle invalid issues (#18111)
Gusted [Tue, 28 Dec 2021 13:28:27 +0000 (13:28 +0000)]
Handle invalid issues (#18111)

* Handle invalid issues

- When you hover over a issue reference, and the issue doesn't exist, it
will just hang on the loading animation.
- This patch fixes that by showing them the pop-up with a "Error
occured" message.

* Add I18N

* refactor

* fix comment for lint

* fix unit test for i18n

* fix unit test for i18n

* add comments

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Mon, 27 Dec 2021 00:28:36 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix documents for Windows development (#18109)
wxiaoguang [Sun, 26 Dec 2021 15:27:18 +0000 (23:27 +0800)]
Fix documents for Windows development (#18109)

* Fix documents for Windows development

2 years agoEnable linter [rule.modifies-value-receiver] and refactor RoleDescriptor (#18093)
Gusted [Sun, 26 Dec 2021 14:56:14 +0000 (14:56 +0000)]
Enable linter [rule.modifies-value-receiver] and refactor RoleDescriptor (#18093)

2 years agodoc: clarify INSTALL_LOCK behavior (#17945)
Rolf Kaiser [Sun, 26 Dec 2021 03:25:42 +0000 (19:25 -0800)]
doc: clarify INSTALL_LOCK behavior (#17945)

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sun, 26 Dec 2021 00:28:42 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd issue hyperlinks in the webhook of wechatwork (#18102)
zjjhot [Sat, 25 Dec 2021 13:30:09 +0000 (21:30 +0800)]
Add issue hyperlinks in the webhook of wechatwork (#18102)

Co-authored-by: zjj <2031381130@qq.com>
2 years agoFix a navbar UI bug in Safari (#18092)
wxiaoguang [Fri, 24 Dec 2021 21:42:01 +0000 (05:42 +0800)]
Fix a navbar UI bug in Safari (#18092)

2 years agoInstead of using routerCtx just escape the url before routing (#18086)
zeripath [Fri, 24 Dec 2021 16:50:49 +0000 (16:50 +0000)]
Instead of using routerCtx just escape the url before routing (#18086)

A consequence of forcibly setting the RoutePath to the escaped url is that the
auto routing to endpoints without terminal slashes fails (Causing #18060.) This
failure raises the possibility that forcibly setting the RoutePath causes other
unexpected behaviors too.

Therefore, instead we should simply pre-escape the URL in the process registering
handler. Then the request URL will be properly escaped for all the following calls.

Fix #17938
Fix #18060
Replace #18062
Replace #17997

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoWhen the git repository on storage is changed, the repository modal should also be...
wxiaoguang [Fri, 24 Dec 2021 15:36:26 +0000 (23:36 +0800)]
When the git repository on storage is changed, the repository modal should also be updated (#18088)

User would keep seeing an empty repo if:
* An error occurs during the first git pushing/receiving
* A user replaces the Gitea's empty repository manually
Fix: when a user is viewing the repository web page, if the repoModal.IsEmpty is true, we check the git repository again to detect whether it is really empty.

However: the IsEmpty flag is deeply broken and should be removed. For example it's possible for a repository to be non-empty by that flag but still 500 because there are no branches - only tags -or the default branch is non-extant as it has been 0-pushed.

2 years ago- name: new parameter in CreateForkOption to give the forked repository (#18066)
Aravinth Manivannan [Fri, 24 Dec 2021 14:43:00 +0000 (14:43 +0000)]
- name: new parameter in CreateForkOption to give the forked repository (#18066)

a custom name, intended to be used when there's a name conflict
- When a fork request results in a name conflict, HTTP 409: Conflict is
  returned instead of 500
- API documentation for the above mentioned changes

Signed-off-by: realaravinth <realaravinth@batsense.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoWhen attempting to subscribe other user to issue report why access denied (#18091)
zeripath [Fri, 24 Dec 2021 13:47:42 +0000 (13:47 +0000)]
When attempting to subscribe other user to issue report why access denied (#18091)

Fix #18090

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoImprove interface when comparing a branch which has created a pull request (#17911)
Lunny Xiao [Fri, 24 Dec 2021 12:14:42 +0000 (20:14 +0800)]
Improve interface when comparing a branch which has created a pull request (#17911)

* Improve interface when comparing a branch which has created a pull request

* Take the note back

2 years agoAdd API to manage repo tranfers (#17963)
qwerty287 [Fri, 24 Dec 2021 04:26:52 +0000 (05:26 +0100)]
Add API to manage repo tranfers (#17963)

2 years agoFix various typos of software names (#18083)
qwerty287 [Fri, 24 Dec 2021 03:56:57 +0000 (04:56 +0100)]
Fix various typos of software names (#18083)

* `git` -> `Git`
* `Github` and `github` -> `GitHub`
* `crowdin` -> `Crowdin`
* `git-lfs` -> `Git LFS`
* `githooks`, `git hooks`, `git-hooks` -> `Git Hooks`
* `discord` -> `Discord`
* `2fa` -> `2FA`
* `gitlab` and `Gitlab` -> `GitLab`
* `web hook` -> `webhook`
* `linux` -> `Linux`
* `sqlite` -> `SQLite`
* `MYSQL` and `mysql` -> `MySQL`
* rename refs to `master` branch -> `main`
* Fix English grammar

2 years agoPrevent NPE if gitea uploader fails to open url (#18080)
zeripath [Thu, 23 Dec 2021 16:27:33 +0000 (16:27 +0000)]
Prevent NPE if gitea uploader fails to open url (#18080)

If http.Get() returns an error return nil and err before attempting to
use the broken file.

Thanks to walker xiong for spotting this bug.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoDo not read or write git reference files directly (#18079)
zeripath [Thu, 23 Dec 2021 13:44:00 +0000 (13:44 +0000)]
Do not read or write git reference files directly (#18079)

Git will and can pack references into packfiles and therefore if you write/read the
files directly you will get false results. Instead you should use update-ref and
show-ref. To that end I have created three new functions in git/repo_commit.go that
will do this correctly.

Related #17191

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoMigrated Repository will show modifications when possible (#17191)
99rgosse [Thu, 23 Dec 2021 08:32:29 +0000 (09:32 +0100)]
Migrated Repository will show modifications when possible (#17191)

* Read patches to get history

2 years agoQuote references to the user table in consistency checks (#18072)
zeripath [Wed, 22 Dec 2021 23:52:57 +0000 (23:52 +0000)]
Quote references to the user table in consistency checks (#18072)

Although #17487 ensured that the table was quoted in the join it missed that the
query part of the check also needed to be quoted.

Fix #17485

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoOnly create pprof files for gitea serv if explicitly asked for (#18068)
zeripath [Wed, 22 Dec 2021 16:48:12 +0000 (16:48 +0000)]
Only create pprof files for gitea serv if explicitly asked for (#18068)

2 years agoAdd NotFound handler (#18062)
zeripath [Wed, 22 Dec 2021 10:39:28 +0000 (10:39 +0000)]
Add NotFound handler (#18062)

PR #17997 means that urls with terminal '/' are no longer immediately mapped
to the url without a terminal slash. However, it has revealed that the NotFound handler
appears to have been lost.

This PR adds back in a NotFound handler that simply redirects to a path without the
terminal slash or runs the NotFound handler.

Fix #18060

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAdd API to get file commit history (#17652)
qwerty287 [Wed, 22 Dec 2021 06:17:33 +0000 (07:17 +0100)]
Add API to get file commit history (#17652)

Adds an API endpoint `api/v1/repos/{owner}/{repo}/git/history/{filepath}` to get the commits affecting the given file or directory.

Closes https://github.com/go-gitea/gitea/issues/16206 and closes https://github.com/go-gitea/gitea/issues/16703

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 22 Dec 2021 00:28:37 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd List-Unsubscribe header (#17804)
mscherer [Tue, 21 Dec 2021 22:53:03 +0000 (23:53 +0100)]
Add List-Unsubscribe header (#17804)

Fixes #13283

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAvoid running go vet twice (#18059)
Gusted [Tue, 21 Dec 2021 18:22:33 +0000 (19:22 +0100)]
Avoid running go vet twice (#18059)

2 years ago[Frontport] Changelog v1.15.8 (#18052)
6543 [Tue, 21 Dec 2021 08:08:48 +0000 (09:08 +0100)]
[Frontport] Changelog v1.15.8 (#18052)

* Changelog v1.15.8

* bump version

2 years agoFix continuance tests (#18027)
Gusted [Tue, 21 Dec 2021 03:12:27 +0000 (04:12 +0100)]
Fix continuance tests (#18027)

2 years agoupdate docker image to latest go version (#18048)
techknowlogick [Tue, 21 Dec 2021 03:11:10 +0000 (22:11 -0500)]
update docker image to latest go version (#18048)

2 years agoTestRepository_GetTag intermittently panics due to an NPE (#18043)
zeripath [Tue, 21 Dec 2021 03:10:16 +0000 (03:10 +0000)]
TestRepository_GetTag intermittently panics due to an NPE (#18043)

There are repeated panics in tests due to TestRepository_GetTag failing
to run properly.  This happens when we attempt to reset the internal
repo for a tag which has failed to load. The problem is - the panic that
this is causing is preventing us from finding what the real error is.

This PR simply moves the failure out so we have a chance to see what
really is failing.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoEnsure that git repository is closed before transfer (#18049)
zeripath [Tue, 21 Dec 2021 02:01:58 +0000 (02:01 +0000)]
Ensure that git repository is closed before transfer (#18049)

Repository Transfer requires that the repository directory is renamed - which
is not possible on Windows if the git repository is open.

Fix #17885

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 21 Dec 2021 00:28:39 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoMake test work with different default branch config (#18038)
mscherer [Mon, 20 Dec 2021 20:55:05 +0000 (21:55 +0100)]
Make test work with different default branch config (#18038)

* Make test work with different default branch config

On a system configured with a different default branch name, doGitInitTestRepository
will create a repository with a branch named differently, and so further tests
would break:

  --- FAIL: TestGit/HTTP/PushCreate/SuccessfullyPushAndCreateTestRepository (0.02s)
      git_helper_for_declarative_test.go:167:
           Error Trace: git_helper_for_declarative_test.go:167
           Error:       Received unexpected error:
                        exit status 1 - error: src refspec master does not match any
                        error: failed to push some refs to 'http://127.0.0.1:3003/user2/repo-tmp-push-create-http.git'
           Test:        TestGit/HTTP/PushCreate/SuccessfullyPushAndCreateTestRepository
  git_test.go:587:
       Error Trace: git_test.go:587
       Error:       Received unexpected error:
                    repository does not exist [id: 0, uid: 0, owner_name: user2, name: repo-tmp-push-create-http]
       Test:        TestGit/HTTP/PushCreate

* Update integrations/git_helper_for_declarative_test.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoExtract CodeMirror styles (#17960)
silverwind [Mon, 20 Dec 2021 20:07:49 +0000 (12:07 -0800)]
Extract CodeMirror styles (#17960)

- Extract CodeMirror-related styles to separate files
- Generalize CodeMirror styles where possible
- Improve fullscreen and side-by-side mode for dark theme

Co-authored-by: 6543 <6543@obermui.de>
2 years agoMigration 204 use Sync2 (#18044)
6543 [Mon, 20 Dec 2021 17:58:38 +0000 (18:58 +0100)]
Migration 204 use Sync2 (#18044)

* format nit

* Sync2

2 years agoMove POST /{username}/action/{action} to simply POST /{username} (#18045)
zeripath [Mon, 20 Dec 2021 17:18:26 +0000 (17:18 +0000)]
Move POST /{username}/action/{action} to simply POST /{username} (#18045)

The current code unfortunately requires that `action` be a reserved
repository name as it prevents posts to change the settings for
action repositories. However, we can simply change action handler
to work on POST /{username} instead.

Fix #18037

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix delete u2f keys modal (#18040)
Lunny Xiao [Mon, 20 Dec 2021 14:49:06 +0000 (22:49 +0800)]
Fix delete u2f keys modal (#18040)

2 years agoReset Session ID on login (#18018)
zeripath [Mon, 20 Dec 2021 14:12:26 +0000 (14:12 +0000)]
Reset Session ID on login (#18018)

* Reset Session ID on login

When logging in the SessionID should be reset and the session cleaned up.

Signed-off-by: Andrew Thornton <art27@cantab.net>
* with new session.RegenerateID function

Signed-off-by: Andrew Thornton <art27@cantab.net>
* update go-chi/session

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Ensure that session id is changed after oauth data is set and between account linking pages too

Signed-off-by: Andrew Thornton <art27@cantab.net>
* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
* as per review

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAdd grafana gitea-mixin (#17758)
Vitaly Zhuravlev [Mon, 20 Dec 2021 07:52:33 +0000 (10:52 +0300)]
Add grafana gitea-mixin (#17758)

This PR adds gitea-mixin, configurable Grafana dashboards (and potentially prometheus alerts+recording rules) based on Gitea [metrics](https://docs.gitea.io/en-us/config-cheat-sheet/#metrics-metrics).

The overview dashboard is described using jsonnet and grafonnet library: https://grafana.github.io/grafonnet-lib/

Mixins help to define dashboard and alerts as code so they can be collaboratively improved by the users.

![image](https://user-images.githubusercontent.com/14870891/142862822-fe57b384-c74a-4103-8548-033e92f90751.png)

__
## Generate config files

You can manually generate dashboards, but first you should install some tools:

```bash
go get github.com/jsonnet-bundler/jsonnet-bundler/cmd/jb
go get github.com/google/go-jsonnet/cmd/jsonnet
# or in brew: brew install go-jsonnet
```

For linting and formatting, you would also need `mixtool` and `jsonnetfmt` installed. If you
have a working Go development environment, it's easiest to run the following:

```bash
go get github.com/monitoring-mixins/mixtool/cmd/mixtool
go get github.com/google/go-jsonnet/cmd/jsonnetfmt
```

The files in `dashboards_out` need to be imported
into your Grafana server.  The exact details will be depending on your environment.

Edit `config.libsonnet` (for example, list of Gitea metrics to be shown under stats can be adjusted). if required and then build JSON dashboard files for Grafana:

```bash
make
```

For more about mixins, please see:
https://github.com/monitoring-mixins/docs
https://www.youtube.com/watch?v=GDdnL5R_l-Y* add gitea mixin

* remove alerts/rules

* gitea-mixin: add interval factor of 1/2 to remove duplicated change events

* gitea-mixin: fix changes panel, add aggregation interval for changes panel

* gitea-mixin: add totals singlestat

* gitea mixin: switch change graph to timeseries type

* add color overrides for issue labels

* bump grafonnet version

* gitea-mixin: convert graphs to timeseries

* gitea-mixin:  make fmt

* gitea-mixin: add .PHONE in Makefile

* gitea-mixin: add time configration

* gitea-mixin: make fmt and collapse addPanel grid

* gitea-mixin: add static ids for shared panels

* gitea-mixin: add flags showIssuesByRepository, showIssuesByLabel to show/hide corresponding panels

* gitea-mixin: update aggregation interval

* gitea-mixin: update defaults

* gitea-mixin: update panel names

* rename dir to gitea-monitoring-mixin

* gitea-mixin: add gitea_issues_open, gitea_issues_closed metrics

* gitea-mixin: update visible name for datasource

* gitea-mixin: update README

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoSimplify parameter types (#18006)
Gusted [Mon, 20 Dec 2021 04:41:31 +0000 (05:41 +0100)]
Simplify parameter types (#18006)

Remove repeated type declarations in function definitions.

2 years agoUpdate chroma (#18033)
zeripath [Mon, 20 Dec 2021 02:49:38 +0000 (02:49 +0000)]
Update chroma (#18033)

Update chroma to 0.9.4

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoPrevent off-by-one error on comments on newly appended lines (#18029)
zeripath [Mon, 20 Dec 2021 02:15:49 +0000 (02:15 +0000)]
Prevent off-by-one error on comments on newly appended lines (#18029)

* Prevent off-by-one error on comments on newly appended lines

There was a bug in CutDiffAroundLine whereby if a file without a terminal new line
has a patch which appends lines to it and a comment is placed on one of those lines
the comment diff will be a line out of place.

This fixes CutDiffAroundLine to simply ignore the missing terminal newline - however,
we should really improve this rendering to add a marker to say that there was a
previously missing terminal newline.

Fix #17875

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoAbort merge if head has been updated before pressing merge (#18032)
zeripath [Mon, 20 Dec 2021 00:32:54 +0000 (00:32 +0000)]
Abort merge if head has been updated before pressing merge (#18032)

* Abort merge if head has been updated before pressing merge

It is possible that a PR head may be pushed to between the merge page being shown
and the merge button being pressed. Pass the current expected head in as a parameter
and cancel the merge if it has changed.

Fix #18028

Signed-off-by: Andrew Thornton <art27@cantab.net>
* adjust swagger

Signed-off-by: Andrew Thornton <art27@cantab.net>
* fix test

Signed-off-by: Andrew Thornton <art27@cantab.net>
* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agono need for docker image mirror (#18031)
techknowlogick [Sun, 19 Dec 2021 21:53:15 +0000 (16:53 -0500)]
no need for docker image mirror (#18031)

Co-authored-by: zeripath <art27@cantab.net>
2 years agoStop printing 03d after escaped characters in logs (#18030)
zeripath [Sun, 19 Dec 2021 21:00:22 +0000 (21:00 +0000)]
Stop printing 03d after escaped characters in logs (#18030)

Strangely a weird bug was present in the log escaping code whereby any escaped
character would gain 03d - this was due to a mistake in the format string where
it should have read %03o but read instead %o03d. This has led to spurious 03d
trailing characters on these escaped characters!

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoReset locale on login (#18023)
zeripath [Sun, 19 Dec 2021 13:31:43 +0000 (13:31 +0000)]
Reset locale on login (#18023)

* Reset locale on login

Fix #18020

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update routers/web/user/auth.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
2 years agoAdd support for ssh commit signing (#17743)
Wim [Sun, 19 Dec 2021 05:37:18 +0000 (06:37 +0100)]
Add support for ssh commit signing (#17743)

* Add support for ssh commit signing

* Split out ssh verification to separate file

* Show ssh key fingerprint on commit page

* Update sshsig lib

* Make sure we verify against correct namespace

* Add ssh public key verification via ssh signatures

When adding a public ssh key also validate that this user actually
owns the key by signing a token with the private key.

* Remove some gpg references and make verify key optional

* Fix spaces indentation

* Update options/locale/locale_en-US.ini

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Update templates/user/settings/keys_ssh.tmpl

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Update options/locale/locale_en-US.ini

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Update options/locale/locale_en-US.ini

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Update models/ssh_key_commit_verification.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Reword ssh/gpg_key_success message

* Change Badsignature to NoKeyFound

* Add sign/verify tests

* Fix upstream api changes to user_model User

* Match exact on SSH signature

* Fix code review remarks

Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoImprove TestPatch to use git read-tree -m and implement git-merge-one-file functional...
zeripath [Sun, 19 Dec 2021 04:19:25 +0000 (04:19 +0000)]
Improve TestPatch to use git read-tree -m and implement git-merge-one-file functionality (#18004)

The current TestPatch conflict code uses a plain git apply which does not properly
account for 3-way merging. However, we can improve things using `git read-tree -m` to
do a three-way merge then follow the algorithm used in merge-one-file. We can also use
`--patience` and/or `--histogram` to generate a nicer diff for applying patches too.

Fix #13679
Fix #6417

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated licenses and gitignores
GiteaBot [Sun, 19 Dec 2021 00:29:01 +0000 (00:29 +0000)]
[skip ci] Updated licenses and gitignores

2 years agoChange <a> elements to underline on hover (#17898)
silverwind [Sat, 18 Dec 2021 05:29:00 +0000 (21:29 -0800)]
Change <a> elements to underline on hover (#17898)

Fomantic brings a opinionated style that removed underline on mouse
hover which I think is important UX to have.

This re-enables the underline in the Fomantic config and fixes a few
cases where underline was deemed disruptive.

2 years ago[skip ci] Updated translations via Crowdin
GiteaBot [Sat, 18 Dec 2021 00:28:35 +0000 (00:28 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoSupport open compare page directly (#17975)
Lunny Xiao [Fri, 17 Dec 2021 22:20:27 +0000 (06:20 +0800)]
Support open compare page directly (#17975)

* Support open compare page directly

* simple code

* Some improvements

Co-authored-by: 6543 <6543@obermui.de>
2 years agoAdd option to define refs in issue templates (#17842)
qwerty287 [Fri, 17 Dec 2021 21:29:09 +0000 (22:29 +0100)]
Add option to define refs in issue templates (#17842)

Adds a markdown header option `ref` that allows you to set the ref the issue should belong.

2 years agoFix outType on gitea dump (#18000)
Gusted [Fri, 17 Dec 2021 13:38:45 +0000 (14:38 +0100)]
Fix outType on gitea dump (#18000)

- Force to output the dump file to use the given `--type`.
- Resolves #17959

2 years agoFix rename notification bug (#18008)
Lunny Xiao [Fri, 17 Dec 2021 06:24:47 +0000 (14:24 +0800)]
Fix rename notification bug (#18008)

2 years agoEnsure complexity, minlength and ispwned are checked on password setting (#18005)
zeripath [Fri, 17 Dec 2021 02:03:39 +0000 (02:03 +0000)]
Ensure complexity, minlength and ispwned are checked on password setting (#18005)

It appears that there are several places that password length, complexity and ispwned
are not currently been checked when changing passwords. This PR adds these.

Fix #17977

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse JSON module instead of stdlib json (#18003)
Gusted [Fri, 17 Dec 2021 01:15:02 +0000 (02:15 +0100)]
Use JSON module instead of stdlib json (#18003)

2 years agoPrevent hang in git cat-file if repository is not a valid repository and other fixes...
zeripath [Thu, 16 Dec 2021 19:01:14 +0000 (19:01 +0000)]
Prevent hang in git cat-file if repository is not a valid repository and other fixes (#17991)

This PR contains multiple fixes. The most important of which is:

* Prevent hang in git cat-file if the repository is not a valid repository

    Unfortunately it appears that if git cat-file is run in an invalid
    repository it will hang until stdin is closed. This will result in
    deadlocked /pulls pages and dangling git cat-file calls if a broken
    repository is tried to be reviewed or pulls exists for a broken
    repository.

    Fix #14734
    Fix #9271
    Fix #16113

Otherwise there are a few small other fixes included which this PR was initially intending to fix:

* Fix panic on partial compares due to missing PullRequestWorkInProgressPrefixes
* Fix links on pulls pages  due to regression from #17551 - by making most /issues routes match /pulls too - Fix #17983
* Fix links on feeds pages due to another regression from #17551 but also fix issue with syncing tags - Fix #17943
* Add missing locale entries for oauth group claims
* Prevent NPEs if ColorFormat is called on nil users, repos or teams.