]> source.dussan.org Git - gitea.git/log
gitea.git
2 years agoDump should only copy regular files and symlink regular files (#20015) v1.18.0-dev
wxiaoguang [Sat, 18 Jun 2022 14:06:32 +0000 (22:06 +0800)]
Dump should only copy regular files and symlink regular files (#20015)

2 years ago[skip ci] Updated translations via Crowdin
zeripath [Sat, 18 Jun 2022 13:10:18 +0000 (13:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated translations via Crowdin
zeripath [Sat, 18 Jun 2022 10:11:27 +0000 (10:11 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd fgprof pprof profiler (#20005)
zeripath [Sat, 18 Jun 2022 10:04:52 +0000 (11:04 +0100)]
Add fgprof pprof profiler (#20005)

fgprof is a sampling Go profiler that allows you to analyze On-CPU as
well as Off-CPU (e.g. I/O) time together.

Go's builtin sampling CPU profiler can only show On-CPU time, but it's
better than fgprof at that. Go also includes tracing profilers that can
analyze I/O, but they can't be combined with the CPU profiler.

fgprof is designed for analyzing applications with mixed I/O and CPU
workloads. This kind of profiling is also known as wall-clock profiling.

Whilst fgprof can cause significant STW latencies in applications with a
lot of goroutines (> 1-10k), these latencies only occur if the profile
is requested - it doesn't cause a delay by simply being available.

The fgprof profile is mounted on
`http://localhost:6060/debug/fgprof?seconds=3`

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
zeripath [Sat, 18 Jun 2022 09:10:16 +0000 (09:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoImprove action table indices (#19472)
zeripath [Sat, 18 Jun 2022 08:46:50 +0000 (09:46 +0100)]
Improve action table indices (#19472)

2 years agoAdd dbconsistency checks for Stopwatches (#20010)
zeripath [Sat, 18 Jun 2022 03:31:00 +0000 (04:31 +0100)]
Add dbconsistency checks for Stopwatches (#20010)

It appears possible that stopwatches can become orphaned or have been orphaned in
the past.

This PR adds Orphan checks for Stopwatches.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agofix push mirrors URL are no longer displayed on the UI (#20011)
Mohamed Sekour [Sat, 18 Jun 2022 03:30:26 +0000 (05:30 +0200)]
fix push mirrors URL are no longer displayed on the UI (#20011)

* fix push mirrors URL are no longer displayed on the UI

Signed-off-by: Mohamed Sekour <mohamed.sekour@exfo.com>
* Update modules/templates/helper.go

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoEmpty log queue on flush and close (#19994)
zeripath [Sat, 18 Jun 2022 02:33:13 +0000 (03:33 +0100)]
Empty log queue on flush and close (#19994)

* Empty log queue on flush and close

It is possible for log events to remain in the buffer off the multichannelledlog
and thus not be logged despite close or flush.

This PR simply adds a function to empty the queue before closing or flushing.
(Except when the logger is paused.)

Reference #19982

Signed-off-by: Andrew Thornton <art27@cantab.net>
* and do similar for ChannelledLog

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
zeripath [Sat, 18 Jun 2022 00:10:15 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoStop spurious APIFormat stopwatches logs (#20008)
zeripath [Fri, 17 Jun 2022 21:47:15 +0000 (22:47 +0100)]
Stop spurious APIFormat stopwatches logs (#20008)

If there are dangling stopwatches with missing issues there will be repeated
logging of Unable to APIFormat stopwatches. These are unhelpful and instead
we should only log if the error is not an issue not exist error.

And we should also prevent an error on missing issue in GetActiveStopwatch too

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoFix CountOrphanedLabels in orphan check (#20009)
zeripath [Fri, 17 Jun 2022 21:42:51 +0000 (22:42 +0100)]
Fix CountOrphanedLabels in orphan check (#20009)

gitea doctor --run check-db-consistency is currently broken due to an incorrect
and old use of Count() with a string.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoWrite Commit-Graphs in RepositoryDumper (#20004)
zeripath [Fri, 17 Jun 2022 20:19:21 +0000 (21:19 +0100)]
Write Commit-Graphs in RepositoryDumper (#20004)

When migrating git repositories we should ensure that the commit-graph is written.

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoAdd fetch.writeCommitGraph to gitconfig (#20006)
zeripath [Fri, 17 Jun 2022 20:18:35 +0000 (21:18 +0100)]
Add fetch.writeCommitGraph to gitconfig (#20006)

Add fetch.writeCommitGraph to gitconfig to ensure that a commit-graph will be written
on git fetch calls.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agomove agit dependcy (#19998)
Lunny Xiao [Fri, 17 Jun 2022 18:17:12 +0000 (02:17 +0800)]
move agit dependcy (#19998)

2 years agoFix a JS error in initRepoCommitLastCommitLoader's entryMap (#19996)
wxiaoguang [Fri, 17 Jun 2022 09:44:35 +0000 (17:44 +0800)]
Fix a JS error in initRepoCommitLastCommitLoader's entryMap (#19996)

2 years agogitconfig: set safe.directory = * (#19870)
singuliere [Fri, 17 Jun 2022 05:49:38 +0000 (07:49 +0200)]
gitconfig: set safe.directory = * (#19870)

Allow git push to work when networked file systems with mixed
ownership are used with Gitea docker images >= 1.16.6 or Gitea
binaries running alongside git versions published after 04/2022.

There are circumstances independent of Gitea (networked file systems
with various permission systems) by which the git repositories managed
by Gitea may have mixed owners. It is not a behavior that Gitea have
control over nor is it a problem as long as the permissions for Gitea to
operate are correct. Gitea instances have been operating under these
conditions for a number of years.

It is detected as a potential security risk ( see
GHSA-vw2c-22j4-2fh2
) by the most recent git versions. However, Gitea always runs git
commands with a current directory matching the repository on
which it operates. That makes Gitea immune from this security problem
and it is safe to ignore the mixed owner permission check.

This gitconfig modification is done on a file dedicated to the user
exclusively used by Gitea.

Fixes: #19455
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix Readme render bug (#19992)
Lunny Xiao [Fri, 17 Jun 2022 05:48:10 +0000 (13:48 +0800)]
Fix Readme render bug (#19992)

Fix #19988

Co-authored-by: zeripath <art27@cantab.net>
2 years agoDelete duplicated update btn on pull request view page (#19993)
Lunny Xiao [Fri, 17 Jun 2022 04:52:06 +0000 (12:52 +0800)]
Delete duplicated update btn on pull request view page (#19993)

Fix #19987

2 years agoUse DisplayName() instead of FullName in Oauth provider (#19991)
oGi4i [Thu, 16 Jun 2022 22:29:54 +0000 (01:29 +0300)]
Use DisplayName() instead of FullName in Oauth provider (#19991)

Use DisplayName() in Oauth as this provides a fallback if FullName is not set.

Closes #19382

2 years agofix permission check for delete tag (#19985)
a1012112796 [Thu, 16 Jun 2022 20:03:03 +0000 (04:03 +0800)]
fix permission check for delete tag (#19985)

fix #19970

by the way, fix some error response about protected tags.

Signed-off-by: a1012112796 <1012112796@qq.com>
2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Thu, 16 Jun 2022 16:10:29 +0000 (16:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRemove legacy git code (ver < 2.0), fine tune markup tests (#19930)
wxiaoguang [Thu, 16 Jun 2022 15:47:44 +0000 (23:47 +0800)]
Remove legacy git code (ver < 2.0), fine tune markup tests (#19930)

* clean git support for ver < 2.0

* fine tune tests for markup (which requires git module)

* remove unnecessary comments

* try to fix tests

* try test again

* use const for GitVersionRequired instead of var

* try to fix integration test

* Refactor CheckAttributeReader to make a *git.Repository version

* update document for commit signing with Gitea's internal gitconfig

* update document for commit signing with Gitea's internal gitconfig

Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Thu, 16 Jun 2022 15:10:36 +0000 (15:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoDon't prevent overflow on y-as (#19978)
Gusted [Thu, 16 Jun 2022 14:49:22 +0000 (16:49 +0200)]
Don't prevent overflow on y-as (#19978)

- Fomantic tries to prevent overflowing on the `y/x`-as by default on
stackable menu's on mobile screens. We already solve this issue by
forcing overflow on x as and hide it on y as(due to some issues with
other menu's), since https://github.com/go-gitea/gitea/pull/19486.
- However this edge case does require a y-overflow to show the dropdown,
because you cannot easily adjust this with CSS, once you're fiddling
with overflow's (https://stackoverflow.com/a/6433475). However
interesting behavior is noted
https://css-tricks.com/popping-hidden-overflow/ when you remove the
position: relative, it will suddenly work again. Well because this is
the only solution without redesigning dropdowns, I think we can live
with the side-effect of the dropdown items being full-width instead
"relative" width to their parent.
- Resolves #19976

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
a1012112796 [Thu, 16 Jun 2022 14:10:29 +0000 (14:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agofix `go to file` link for mirror repository (#19983)
a1012112796 [Thu, 16 Jun 2022 12:37:13 +0000 (20:37 +0800)]
fix `go to file` link for mirror repository (#19983)

the `BaseRepo` not always exit, should
use `Repository`.

Signed-off-by: a1012112796 <1012112796@qq.com>
2 years agoDon't buffer doctor logger (#19982)
Gusted [Thu, 16 Jun 2022 09:10:33 +0000 (11:10 +0200)]
Don't buffer doctor logger (#19982)

- We don't need to buffer the logger with a thousand capacity. It's not
a high-throughput logger, this also caused issue whereby the logger
can't keep up with repeated messages being send(somehow they are lost in
the queue?).
- Resolves #19969

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoAllow render HTML with css/js external links (#19017)
Lunny Xiao [Thu, 16 Jun 2022 03:33:23 +0000 (11:33 +0800)]
Allow render HTML with css/js external links (#19017)

* Allow render HTML with css/js external links

* Fix bug because of filename escape chars

* Fix lint

* Update docs about new configuration item

* Fix bug of render HTML in sub directory

* Add CSP head for displaying iframe in rendering file

* Fix test

* Apply suggestions from code review

Co-authored-by: delvh <dev.lh@web.de>
* Some improvements

* some improvement

* revert change in SanitizerDisabled of external renderer

* Add sandbox for iframe and support allow-scripts and allow-same-origin

* refactor

* fix

* fix lint

* fine tune

* use single option RENDER_CONTENT_MODE, use sandbox=allow-scripts

* fine tune CSP

* Apply suggestions from code review

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse correct count for `NumOpenIssues` (#19980)
Gusted [Thu, 16 Jun 2022 02:51:34 +0000 (04:51 +0200)]
Use correct count for `NumOpenIssues` (#19980)

- Don't specify the field in `Count` instead use `Cols` for this.
- Call `log.Error` when a error occur.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoIn code search, get code unit accessible repos in one (main) query (#19764)
Hugo Hoitink [Wed, 15 Jun 2022 23:24:10 +0000 (01:24 +0200)]
In code search, get code unit accessible repos in one (main) query (#19764)

* When non-admin users use code search, get code unit accessible repos in one main query

* Modified some comments to match the changes

* Removed unnecessary check for Access Mode in Collaboration table

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Wed, 15 Jun 2022 22:10:15 +0000 (22:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAlways try to fetch repo for mirrors (#19975)
Gusted [Wed, 15 Jun 2022 15:58:44 +0000 (17:58 +0200)]
Always try to fetch repo for mirrors (#19975)

- Always give a best-effort to fetching the repositories, if even that
fails indeed give a disconnected mirror found error.
- *Partially* resolves #19928

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoRemove tab/TabName usage where it's not needed (#19973)
Lauris BH [Wed, 15 Jun 2022 15:05:32 +0000 (18:05 +0300)]
Remove tab/TabName usage where it's not needed (#19973)

`tab` query argument and `TabName` in context is used only in profile so remove it from all other places where it's not used anymore.

2 years agoFix cli command restore-repo: "units" should be parsed as StringSlice (#19953)
wxiaoguang [Wed, 15 Jun 2022 12:28:03 +0000 (20:28 +0800)]
Fix cli command restore-repo: "units" should be parsed as StringSlice (#19953)

* Fix cli command restore-repo: "units" should be parsed as StringSlice because after  #15790 it's read by c.StringSlice("units").  Before, the "units" were processed by strings.Split
* Add checking for invalid unit names

Co-authored-by: 6543 <6543@obermui.de>
2 years agoUppercase first languages letters (#19965)
AHOHNMYC [Wed, 15 Jun 2022 10:08:49 +0000 (13:08 +0300)]
Uppercase first languages letters (#19965)

2 years agoMove tests as seperate sub packages to reduce duplicated file names (#19951)
Lunny Xiao [Wed, 15 Jun 2022 07:02:00 +0000 (15:02 +0800)]
Move tests as seperate sub packages to reduce duplicated file names (#19951)

2 years agoReplace unstyled meter with progress (#19968)
silverwind [Wed, 15 Jun 2022 04:28:24 +0000 (06:28 +0200)]
Replace unstyled meter with progress (#19968)

Replace the only `<meter>` element in use with a `<progress>` which is
styled properly. Also slightly adjust colors on it for better contrast.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
singuliere [Wed, 15 Jun 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years ago[skip ci] Updated translations via Crowdin
singuliere [Tue, 14 Jun 2022 00:10:10 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoRemove singuliere from MAINTAINERS (#19883)
singuliere [Mon, 13 Jun 2022 20:05:41 +0000 (22:05 +0200)]
Remove singuliere from MAINTAINERS (#19883)

2 years agoFix aria for logo (#19955)
wxiaoguang [Mon, 13 Jun 2022 18:46:39 +0000 (02:46 +0800)]
Fix aria for logo (#19955)

Co-authored-by: 6543 <6543@obermui.de>
2 years agoFix mirror template bug (#19959)
Lunny Xiao [Mon, 13 Jun 2022 16:12:59 +0000 (00:12 +0800)]
Fix mirror template bug (#19959)

* Fix mirror template bug

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoAdd deprecated log when using MySQL with utf8 charset (#19952)
Lunny Xiao [Mon, 13 Jun 2022 12:55:08 +0000 (20:55 +0800)]
Add deprecated log when using MySQL with utf8 charset (#19952)

2 years agoMove issues related files into models/issues (#19931)
Lunny Xiao [Mon, 13 Jun 2022 09:37:59 +0000 (17:37 +0800)]
Move issues related files into models/issues (#19931)

* Move access and repo permission to models/perm/access

* fix test

* fix git test

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh

* Move issues related code to models/issues

* Move some issues related sub package

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

* Rename some files

2 years agofix: some typos (#19956)
yutotnh [Mon, 13 Jun 2022 07:34:46 +0000 (16:34 +0900)]
fix: some typos (#19956)

2 years ago[skip ci] Updated translations via Crowdin
Lunny Xiao [Mon, 13 Jun 2022 00:10:09 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoMove some code into models/git (#19879)
Lunny Xiao [Sun, 12 Jun 2022 15:51:54 +0000 (23:51 +0800)]
Move some code into models/git (#19879)

* Move access and repo permission to models/perm/access

* fix test

* Move some git related files into sub package models/git

* Fix build

* fix git test

* move lfs to sub package

* move more git related functions to models/git

* Move functions sequence

* Some improvements per @KN4CK3R and @delvh

2 years agoFix signal loop in graceful manager (#19943)
wxiaoguang [Sun, 12 Jun 2022 13:50:18 +0000 (21:50 +0800)]
Fix signal loop in graceful manager (#19943)

2 years agoPrettify number of issues (#17760)
Gusted [Sun, 12 Jun 2022 12:08:23 +0000 (14:08 +0200)]
Prettify number of issues (#17760)

* Prettify number of issues

- Use the PrettyNumber function to add commas in large amount of issues.

* Use client-side formatting

* prettify on both server and client

* remove unused i18n entries

* handle more cases, support other int types in PrettyNumber

* specify locale to avoid issues with node default locale

* remove superfluos argument

* introduce template helper, octicon tweaks, js refactor

* Update modules/templates/helper.go

* Apply some suggestions.

* Add comment

* Update templates/user/dashboard/issues.tmpl

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoImprove file header on mobile (#19945)
Gusted [Sun, 12 Jun 2022 09:30:22 +0000 (11:30 +0200)]
Improve file header on mobile (#19945)

- File headers can become quite width, so ensure the file size is not
being wrapped into itself(width + padding-right) and allow the overflow
to be scrolled(overflow-x).

2 years agoUnify repo settings & show better error (#19828)
Gusted [Sun, 12 Jun 2022 05:43:27 +0000 (07:43 +0200)]
Unify repo settings & show better error (#19828)

* Unify context data
* Actually show invalid url in error

2 years ago[skip ci] Updated translations via Crowdin
xkcdstickfigure [Sun, 12 Jun 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agofixed comment typo (#19944)
xkcdstickfigure [Sat, 11 Jun 2022 18:54:08 +0000 (19:54 +0100)]
fixed comment typo (#19944)

2 years agoAuto merge pull requests when all checks succeeded via WebUI (#19648)
6543 [Sat, 11 Jun 2022 14:44:20 +0000 (16:44 +0200)]
Auto merge pull requests when all checks succeeded via WebUI (#19648)

Add WebUI part of Auto merge feature

close #19621

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2 years agoFix some mirror bugs (#18649)
Lunny Xiao [Sat, 11 Jun 2022 13:50:14 +0000 (21:50 +0800)]
Fix some mirror bugs (#18649)

* Fix some mirror bugs

* Remove unnecessary code

* Fix lint

* rename stdard url

* Allow more charactors in git ssh protocol url

* improve the detection

* support ipv6 for git url parse

* Fix bug

* Fix template

* Fix bug

* fix template

* Fix tmpl

* Fix tmpl

* Fix parse ssh with interface

* Rename functions name

Co-authored-by: zeripath <art27@cantab.net>
2 years agoFix data-race problems in git module (quick patch) (#19934)
wxiaoguang [Sat, 11 Jun 2022 03:56:27 +0000 (11:56 +0800)]
Fix data-race problems in git module (quick patch) (#19934)

* Fix data-race problems in git module

* use HomeDir instead of setting.RepoRootPath

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
silverwind [Sat, 11 Jun 2022 00:10:12 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFix copy/paste of empty lines (#19798)
silverwind [Fri, 10 Jun 2022 13:45:28 +0000 (15:45 +0200)]
Fix copy/paste of empty lines (#19798)

* Fix copy/paste of empty newlines again

Fixes: https://github.com/go-gitea/gitea/issues/19331
Regressed by: https://github.com/go-gitea/gitea/pull/18270

Needed to do another newline addition to the Chroma output HTML to get
copy/paste work again. The previous replacement conditions are probably
obsolete, but as I'm not 100% sure, I opted to keep them.

Specifically, the Chroma HTML change mentioned in
https://github.com/go-gitea/gitea/pull/18270#issuecomment-1013350246
broke our previous newline replacement for such empty lines.

Also included are a few changes to make the test more pleasant to work
with.

* run go mod tidy

* add util.Dedent

* copy in the code

Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years agoNormalize line endings in fomantic build files (#19932)
silverwind [Fri, 10 Jun 2022 12:24:02 +0000 (14:24 +0200)]
Normalize line endings in fomantic build files (#19932)

Ensures consistent line endings to avoid useless diffs because there is
somthing platform-dependant in that build.

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoMake user profile image show full image on mobile (#19840)
Eekle [Fri, 10 Jun 2022 11:06:34 +0000 (12:06 +0100)]
Make user profile image show full image on mobile (#19840)

* Make user profile image show full image on mobile

2 years agoCustom regexp external issues (#17624)
Sandro Santilli [Fri, 10 Jun 2022 05:39:53 +0000 (07:39 +0200)]
Custom regexp external issues (#17624)

* Implement custom regular expression for external issue tracking.

Signed-off-by: Alexander Beyn <malex@fatelectrons.org>
* Fix syntax/style

* Update repo.go

* Set metas['regexp']

* gofmt

* fix some tests

* fix more tests

* refactor frontend

* use LRU cache for regexp

* Update modules/markup/html_internal_test.go

Co-authored-by: Alexander Beyn <malex@fatelectrons.org>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
Co-authored-by: Lauris BH <lauris@nix.lv>
Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoUse Golang 1.18 for Gitea 1.17 release (#19918)
wxiaoguang [Fri, 10 Jun 2022 03:34:41 +0000 (11:34 +0800)]
Use Golang 1.18 for Gitea 1.17 release (#19918)

Use Golang 1.18 (as minimal requirement) for Gitea 1.17 release, make sure the Golang version is still actively supported during Gitea 1.17 lifecycle.

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
2 years agoRefactor git module, make Gitea use internal git config (#19732)
wxiaoguang [Fri, 10 Jun 2022 01:57:49 +0000 (09:57 +0800)]
Refactor git module, make Gitea use internal git config (#19732)

* Refactor git module, make Gitea use internal git config, add safe.directory config

* introduce git.InitSimple and git.InitWithConfigSync, make serv cmd use gitconfig

* use HOME instead of GIT_CONFIG_GLOBAL, because git always needs a correct HOME

* fix cmd env in cmd/serv.go

* fine tune error message

* Fix a incorrect test case

* fix configAddNonExist

* fix configAddNonExist logic, add `--fixed-value` flag, add tests

* add configSetNonExist function in case it's needed.

* use configSetNonExist for `user.name` and `user.email`

* add some comments

* Update cmd/serv.go

Co-authored-by: zeripath <art27@cantab.net>
* Update cmd/serv.go

Co-authored-by: zeripath <art27@cantab.net>
* Update modules/git/git.go

Co-authored-by: zeripath <art27@cantab.net>
* Update modules/setting/setting.go

Co-authored-by: zeripath <art27@cantab.net>
* Update modules/git/repo_attribute.go

Co-authored-by: zeripath <art27@cantab.net>
* fix spaces in messages

* use `configSet("core.protectNTFS", ...)` instead of `globalCommandArgs`

* remove GIT_CONFIG_NOSYSTEM, continue to use system's git config

* Update cmd/serv.go

Co-authored-by: zeripath <art27@cantab.net>
* fix merge

* remove code for safe.directory

* separate git.CommonEnvs to CommonGitCmdEnvs and CommonCmdServEnvs

* avoid Golang's data race error

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Roger Luo [Fri, 10 Jun 2022 00:10:33 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoFeature: Find files in repo (#15028)
Roger Luo [Thu, 9 Jun 2022 11:15:08 +0000 (19:15 +0800)]
Feature: Find files in repo (#15028)

* Create finding files page ui in repo page

* Get tree entries for find repo files.

* Move find files JS to individual file.

* gen swagger.

* Add enry.IsVendor to exclude entries

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoPrevent NPE whilst migrating if there is a team request review (#19855)
zeripath [Thu, 9 Jun 2022 02:50:05 +0000 (03:50 +0100)]
Prevent NPE whilst migrating if there is a team request review (#19855)

A pr.Reviewer may be nil when migrating from Gitea if this is a team
request review.

We do not migrate teams therefore we cannot map these requests, but we can
migrate user requests.

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
Lauris BH [Thu, 9 Jun 2022 00:10:14 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd support for rendering terminal output with colors (#19497)
Lauris BH [Wed, 8 Jun 2022 21:46:39 +0000 (00:46 +0300)]
Add support for rendering terminal output with colors (#19497)

2 years agoFix viewed images not loading in a PR (#19919)
wxiaoguang [Wed, 8 Jun 2022 17:19:06 +0000 (01:19 +0800)]
Fix viewed images not loading in a PR (#19919)

Close #19651

2 years agoRemove out-dated comments (#19921)
wxiaoguang [Wed, 8 Jun 2022 17:17:44 +0000 (01:17 +0800)]
Remove out-dated comments (#19921)

2 years agoAutomatically render wiki TOC (#19873)
zeripath [Wed, 8 Jun 2022 08:59:16 +0000 (09:59 +0100)]
Automatically render wiki TOC (#19873)

Automatically add sidebar in the wiki view containing a TOC for the wiki page.
Make the TOC collapsable

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoImprove wording on delete access token modal (#19909)
André Jaenisch [Wed, 8 Jun 2022 00:28:10 +0000 (02:28 +0200)]
Improve wording on delete access token modal (#19909)

This PR highlights the nature of the destructive action.
It also rewords the action buttons to remove ambiguity.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: Lauris BH <lauris@nix.lv>
2 years ago[skip ci] Updated translations via Crowdin
Gusted [Wed, 8 Jun 2022 00:10:16 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoAdd breaking email restrictions checker in doctor (#19903)
Gusted [Tue, 7 Jun 2022 20:51:33 +0000 (22:51 +0200)]
Add breaking email restrictions checker in doctor (#19903)

* Add breaking change check in doctor

- This patch introduces a new kind of doctor type, breaking. This file
is made to register checks that helps with detecting when a breaking
change might impact a Gitea instance.
- For now the only check here(and the reason of creating this) is to
check if all users in the database has a valid email address, which
might not be the case after
https://github.com/go-gitea/gitea/pull/17688. This _simply_ uses the
validation function to detect and report these cases.
- Helps admins with detecting #19897.
- I have no clue which priority should be and IsDefault is true, because
when breaking change happen and we have a doctor check for it, we can
say "run `gitea doctor` to help you with this and maybe you find other
errors :wink:".

* Makes no sense tbh

* Fix copyright

* Update modules/doctor/breaking.go

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <matti@mdranta.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoEnsure minimum mirror interval is reported on settings page (#19895)
zeripath [Tue, 7 Jun 2022 17:40:12 +0000 (18:40 +0100)]
Ensure minimum mirror interval is reported on settings page (#19895)

* Ensure minimum mirror interval is reported on settings page

Expecting users to guess the minimum mirror interval appears a little unkind.
In this PR we simply change the locale string to include the minimum interval.
This will of course be affected by our current localization framework but...
we can fix that else where.

This PR also includes some fixes for error handling on the settings page as
previously the mirror block amongst others would simply disappear on error.

Fix #3737

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update options/locale/locale_en-US.ini

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* placate lint

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Update options/locale/locale_en-US.ini

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
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 UX on modal for deleting an access token (#19894)
André Jaenisch [Tue, 7 Jun 2022 16:25:40 +0000 (18:25 +0200)]
Improve UX on modal for deleting an access token (#19894)

* Improve UX on modal for deleting an access token

Before, both action buttons where coloured on hover. Otherwise they
appeared as ghost buttons. UX tells us, that call to action must not
be displayed as ghost button.

Using red is perceived as warning colour in Western cultures. It was
used for the non-destructive action before. This PR swaps the colour
and turns the cancel button into a filled one, so it is saver to do
nothing then to accidentally delete an access button. We want the
person to do this consciously.

In another iteration the wording here could be improved. See the
associated issue for further details.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
* Use tabs instead of spaces.

Linter does not complain anymore. I was expecting the formatter to pick
this up but it didn't.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
2 years agoupdate discord invite (#19907)
Eugene [Tue, 7 Jun 2022 15:40:27 +0000 (18:40 +0300)]
update discord invite (#19907)

2 years agoOnly log non ErrNotExist errors in git.GetNote (#19884)
Lunny Xiao [Tue, 7 Jun 2022 08:39:50 +0000 (16:39 +0800)]
Only log non ErrNotExist errors in git.GetNote  (#19884)

* Fix GetNote

* Only log errors if the error is not ErrNotExist

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years ago[skip ci] Updated translations via Crowdin
wxiaoguang [Tue, 7 Jun 2022 00:10:19 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate frontend guideline (#19901)
wxiaoguang [Mon, 6 Jun 2022 14:44:20 +0000 (22:44 +0800)]
Update frontend guideline (#19901)

* update frontend guideline

* "Native" => "Vanilla JS", fix typo comma.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoMake AppDataPath absolute against the AppWorkPath if it is not (#19815)
zeripath [Mon, 6 Jun 2022 14:43:17 +0000 (15:43 +0100)]
Make AppDataPath absolute against the AppWorkPath if it is not (#19815)

* Make AppDataPath absolute against the AppWorkPath if it is not

There are multiple repeated issues whereby a non-absolute provided
APP_DATA_PATH causes strange issues.

This PR simply absolutes the APP_DATA_PATH against the AppWorkPath if
its not so. It also ensures that AppWorkPath is also always absolute.

Ref #19367

Signed-off-by: Andrew Thornton <art27@cantab.net>
* Add logging

Signed-off-by: Andrew Thornton <art27@cantab.net>
* absolute workpath against pwd instead of app path first

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoMove some repository related code into sub package (#19711)
Lunny Xiao [Mon, 6 Jun 2022 08:01:49 +0000 (16:01 +0800)]
Move some repository related code into sub package (#19711)

* Move some repository related code into sub package

* Move more repository functions out of models

* Fix lint

* Some performance optimization for webhooks and others

* some refactors

* Fix lint

* Fix

* Update modules/repository/delete.go

Co-authored-by: delvh <dev.lh@web.de>
* Fix test

* Merge

* Fix test

* Fix test

* Fix test

* Fix test

Co-authored-by: delvh <dev.lh@web.de>
2 years agoA minimal change to replace data calls with attr as per guidelines (#19900)
André Jaenisch [Mon, 6 Jun 2022 04:58:53 +0000 (06:58 +0200)]
A minimal change to replace data calls with attr as per guidelines (#19900)

This affects the manage topics on a repository.
Namely the done button once changes are made.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2 years agoModernize JS build scripts (#19824)
silverwind [Mon, 6 Jun 2022 03:27:25 +0000 (05:27 +0200)]
Modernize JS build scripts (#19824)

- Remove __dirname, use file URLs instead
- Upgrade fabric dependency
- Use fs/promises syntax, this breaks node 12 but we require 14 already

The change in public/img/favicon.svg is not caused by the fabric
upgrade, but it seems it was not properly generated when introduced.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years ago[skip ci] Updated translations via Crowdin
Wim [Mon, 6 Jun 2022 00:10:13 +0000 (00:10 +0000)]
[skip ci] Updated translations via Crowdin

2 years agoUpdate MAINTAINERS (#19896)
Wim [Sun, 5 Jun 2022 19:55:08 +0000 (21:55 +0200)]
Update MAINTAINERS (#19896)

Added myself as maintainer
[List of PRs](https://github.com/go-gitea/gitea/pulls?q=is%3Apr+author%3A42wim+is%3Aclosed)

2 years agoAdd alt text to logo (#19892)
André Jaenisch [Sun, 5 Jun 2022 09:41:51 +0000 (11:41 +0200)]
Add alt text to logo (#19892)

The recommended way is to use the name of the organisation followed
by "logo". however, since this is my first contribution, I am not
entirely sure, whether this is the best approach here.

The organisation is different from the organisation you can create as
part of the application. Instead, it is more related to the site
hosting the instance. Plus, I don't know how to best handle it when
the logo image is swapped out. Therefore, I use plain "Logo" and hope
that the person visiting the site has enough context.

Signed-off-by: André Jaenisch <andre.jaenisch@posteo.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoLimit max-height of CodeMirror editors for issue comment and wiki (#18271)
Martijn de Boer [Sun, 5 Jun 2022 08:09:50 +0000 (10:09 +0200)]
Limit max-height of CodeMirror editors for issue comment and wiki (#18271)

* Make the wiki editor bar sticky for longer wiki edits

On codeberg community it was requested to make the wiki editor toolbar sticky for longer wiki posts, so one wouldn't have to scroll to the top to use it. (Reference; https://codeberg.org/Codeberg/Community/issues/533).

In order to make this happen, the .editor-toolbar class needs to become position: sticky, and we need to fix it's transparent background and border-bottom. Because the bottom disappears, we add it. This makes the border become a double border, because the CodeMirror area defines borders for all. As such I've added a border-top: none, on the wiki write tab for the CodeMirror class.

* Make the issue bar in the issue view sticky for issue #10675

In issue #10675 it's requested to make the issue bar sticky upon scrolling in the issue view. The proposed change changes inline html, which is not desirable. As such I've added the position sticky option to it's container, and fix the background upon scrolling.

* Make linter happy on _repository.less

Fix 0px -> 0 to make the linter happy.

* Make linter happy on _editor.less

Fix 0px -> 0 to make the linter happy.

* Change z-index to the lowest boundary of 1

As per review of @silverwind change the z-index to it's lowest requirement of 1.

* Change z-index to the lowest boundary of 1

As per review of @silverwind change the z-index to it's lowest requirement of 1.

* Revert changes made to wiki editor (unsticky) and add max-height

Fixes the max-height to 85vh, on the proposed 90vh it just came out just slightly too large.
Unstickies the changes from the sticky commits.

* Revert changes for the sticky title editor

Removes the changes as done by the sticky title editor.

* Add max-height definition to CodeMirror-scroll

Add the max-height definition for the CodeMirror-scroll class in order to generalize the changes spoken about in PR #18271

* Remove CodeMirror-scroll definition

Remove the max-height in CodeMirror-scroll definition, in order to generalize it in the CodeMirror less file. As per discussion in #18271.

* fine tune CodeMirror min-height/max-height

Co-authored-by: 6543 <6543@obermui.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoImplement http signatures support for the API (#17565)
Wim [Sun, 5 Jun 2022 07:16:14 +0000 (09:16 +0200)]
Implement http signatures support for the API (#17565)

Fixes #12338

This allows use to talk to the API with our ssh certificate (and/or ssh-agent) without needing to fetch an API key or tokens.
It will just automatically work when users have added their ssh principal in gitea.

This needs client code in tea
Update: also support normal pubkeys

ref: https://tools.ietf.org/html/draft-cavage-http-signatures

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: zeripath <art27@cantab.net>
Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agoIncrement tests time out from 40m to 50m because sometimes the machine is slow (...
Lunny Xiao [Sun, 5 Jun 2022 04:24:51 +0000 (12:24 +0800)]
Increment tests time out from 40m to 50m because sometimes the machine is slow (#19887)

2 years agofix(CI/CD): correct CI variable. (#19886)
Bo-Yi Wu [Sun, 5 Jun 2022 02:42:24 +0000 (10:42 +0800)]
fix(CI/CD): correct CI variable. (#19886)

default value is true for CI variable

see https://docs.drone.io/pipeline/environment/reference/ci/

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoFix typo (#19889)
Gusted [Sat, 4 Jun 2022 21:43:25 +0000 (21:43 +0000)]
Fix typo (#19889)

2 years agoFixing wrong paging when filtering on the issue dashboard (#19801)
Mai-Lapyst [Sat, 4 Jun 2022 20:12:14 +0000 (22:12 +0200)]
Fixing wrong paging when filtering on the issue dashboard (#19801)

Fixes #19791 by adding an check if filtering after any repo; if yes, simply set the total count for the pageing to the sum of the issue count for each selected repo by utilize `issueCountByRepo`.

Fix #19791

2 years agoMove `/info` outside authorization (#19888)
Gusted [Sat, 4 Jun 2022 20:10:54 +0000 (20:10 +0000)]
Move `/info` outside authorization (#19888)

- To use the web's API to get information about a issue/pull on a
repository, doesn't require authorization(nor that the repository isn't
archived).
- Regressed by: #19318

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Andrew Thornton <art27@cantab.net>
2 years agoFix order by parameter (#19849)
Lunny Xiao [Sat, 4 Jun 2022 19:18:50 +0000 (03:18 +0800)]
Fix order by parameter (#19849)

Upgrade builder to v0.3.11
Upgrade xorm to v1.3.1 and fixed some hidden bugs.

Replace #19821
Replace #19834
Included #19850

Co-authored-by: zeripath <art27@cantab.net>
2 years agoExclude Archived repos from Dashboard Milestones (#19882)
zeripath [Sat, 4 Jun 2022 18:30:01 +0000 (19:30 +0100)]
Exclude Archived repos from Dashboard Milestones (#19882)

Milestones in archived repos should not be displayed on `/milestones`. Therefore
we should exclude these repositories from milestones page.

Fix #18257

Signed-off-by: Andrew Thornton <art27@cantab.net>
2 years agouse exact search instead of fuzzy search for branch filter dropdown (#19885)
wxiaoguang [Sat, 4 Jun 2022 16:02:10 +0000 (00:02 +0800)]
use exact search instead of fuzzy search for branch filter dropdown (#19885)

2 years agoAdd API to serve blob or LFS file content (#19689)
qwerty287 [Sat, 4 Jun 2022 13:17:53 +0000 (15:17 +0200)]
Add API to serve blob or LFS file content (#19689)

* Add LFS API

* Update routers/api/v1/repo/file.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Apply suggestions

* Apply suggestions

* Update routers/api/v1/repo/file.go

Co-authored-by: Gusted <williamzijl7@hotmail.com>
* Report errors

* ADd test

* Use own repo for test

* Use different repo name

* Improve handling

* Slight restructures

1. Avoid reading the blob data multiple times
2. Ensure that caching is only checked when about to serve the blob/lfs
3. Avoid nesting by returning early
4. Make log message a bit more clear
5. Ensure that the dataRc is closed by defer when passed to ServeData

Signed-off-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Gusted <williamzijl7@hotmail.com>
Co-authored-by: Andrew Thornton <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2 years agoDisable unnecessary mirroring elements (#18527)
Paweł Bogusławski [Sat, 4 Jun 2022 11:42:17 +0000 (13:42 +0200)]
Disable unnecessary mirroring elements (#18527)

* Disable unnecessary mirroring elements

This mod fixes disabling unnecessary mirroring elements.

Related: https://github.com/go-gitea/gitea/pull/16957
Related: https://github.com/go-gitea/gitea/pull/13084
Author-Change-Id: IB#1105104

* Checkbox rendering disabled instead of hiding it

Fixes: 02b45051503d4330da9757ff084c9cc5e6e60d84
Related: https://github.com/go-gitea/gitea/pull/18527#pullrequestreview-878061913
Author-Change-Id: IB#1105104

* Update custom/conf/app.example.ini

Co-authored-by: silverwind <me@silverwind.io>
* Update docs/content/doc/advanced/config-cheat-sheet.en-us.md

Co-authored-by: silverwind <me@silverwind.io>
* Mirror filter removed only when whole mirroring feature is disabled

Fixes: 02b45051503d4330da9757ff084c9cc5e6e60d84
Related: https://github.com/go-gitea/gitea/pull/18527#discussion_r883268890
Author-Change-Id: IB#1105104

Co-authored-by: silverwind <me@silverwind.io>