aboutsummaryrefslogtreecommitdiffstats
path: root/modules
Commit message (Collapse)AuthorAgeFilesLines
* Performance optimization for git push (#30104) (#30354)Lunny Xiao2024-04-101-10/+15
| | | | | | | Agit returned result should be from `ProcReceive` hook but not `PostReceive` hook. Then for all non-agit pull requests, it will not check the pull requests for every pushing `refs/pull/%d/head`. Backport #30104
* Close file in the Upload func (#30262) (#30269)Giteabot2024-04-031-2/+2
| | | Co-authored-by: guangwu <guoguangwu@magic-shield.com>
* Fixes #27605: inline math blocks can't be preceeded/followed by ↵Giteabot2024-04-032-7/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | alphanumerical characters (#30175) (#30250) Backport #30175 by @jmlt2002 - Inline math blocks couldn't be preceeded or succeeded by alphanumerical characters due to changes introduced in PR #21171. Removed the condition that caused this (precedingCharacter condition) and added a new exit condition of the for-loop that checks if a specific '$' was escaped using '\' so that the math expression can be rendered as intended. - Additionally this PR fixes another bug where math blocks of the type '$xyz$abc$' where the dollar sign was not escaped by the user, generated an error (shown in the screenshots below) - Altered the tests to accomodate for the changes Former behaviour (from try.gitea.io): ![image](https://github.com/go-gitea/gitea/assets/114936010/8f0cbb21-321d-451c-b871-c67a8e1e9235) Fixed behaviour (from my local build): ![image](https://github.com/go-gitea/gitea/assets/114936010/5c22687c-6f11-4407-b5e7-c14b838bc20d) (Edit) Source code for the README.md file: ``` $x$ -$x$ $x$- a$xa$ $xa$a 1$xb$ $xb$1 $a a$b b$ a$b $a a$b b$ $a a\$b b$ ``` Signed-off-by: João Tiago <joao.leal.tintas@tecnico.ulisboa.pt> Co-authored-by: João Tiago <114936010+jmlt2002@users.noreply.github.com>
* Include encoding in signature payload (#30174) (#30181)Giteabot2024-04-013-0/+75
| | | | | | | | | | | | | | | | | | | Backport #30174 by @KN4CK3R Fixes #30119 Include the encoding in the signature payload. before ![grafik](https://github.com/go-gitea/gitea/assets/1666336/01ab94a3-8af5-4d6f-be73-a10b65a15421) after ![grafik](https://github.com/go-gitea/gitea/assets/1666336/3a37d438-c70d-4d69-b178-d170e74aa683) --------- Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix gitea doctor will remove repo-avatar files when execute command ↵yp053272024-03-271-1/+1
| | | | | storage-archives (#30094) (#30120) backport #30094
* Fix panic for fixBrokenRepoUnits16961 (#30068) (#30100)yp053272024-03-261-0/+6
| | | backport #30068
* Performance improvements for pull request list page (#29900) (#29972)Lunny Xiao2024-03-221-0/+9
| | | | | | | | | This PR will avoid load pullrequest.Issue twice in pull request list page. It will reduce x times database queries for those WIP pull requests. Partially fix #29585 Backport #29900
* Fix loadOneBranch panic (#29938) (#29939)wxiaoguang2024-03-201-1/+1
| | | | | | | Backport #29938 Try to fix #29936 Far from ideal, but still better than panic.
* Show Actions post step when it's running (#29926) (#29928)Giteabot2024-03-202-2/+46
| | | | | | | | | | | | | | | | | | Backport #29926 by @wolfogre The post step was always waiting, even if all steps were done. Then, once the task was done, the post step became success immediately. Before: <img width="915" alt="xnip_240320_120228" src="https://github.com/go-gitea/gitea/assets/9418365/00347430-f998-4c43-917a-bf6dd6d0e333"> After: <img width="905" alt="xnip_240320_120443" src="https://github.com/go-gitea/gitea/assets/9418365/a419b111-17c2-4029-a022-c761cc419091"> Co-authored-by: Jason Song <i@wolfogre.com>
* Make meilisearch do exact search for issues (#29740 & #29671) (#29846)65432024-03-162-1/+29
| | | | Backport https://github.com/go-gitea/gitea/pull/29740 (based on #29671 ...)
* Support GITEA_I_AM_BEING_UNSAFE_RUNNING_AS_ROOT env (#29788) (#29791)Giteabot2024-03-141-0/+3
| | | | | | | | | | | | | | | | | | | | | | | Backport #29788 by @wolfogre I was trying to run unit tests for Gitea on act runner, by using `make test`. It failed with log: ``` 2024/03/14 03:09:26 ...s/setting/setting.go:180:loadRunModeFrom() [F] Gitea is not supposed to be run as root. Sorry. If you need to use privileged TCP ports please instead use setcap and the `cap_net_bind_service` permission ``` So it will be convenient to skip by setting environment, since it's OK to use root user in job containers. It's not a bug, but I want to backport it to v1.21 since it doesn't break anything. --------- Co-authored-by: Jason Song <i@wolfogre.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix date rendering by adding `<gitea-absolute-date>` (#29725) (#29747)Giteabot2024-03-132-14/+16
| | | | | | | | | | | | | | | | | Backport #29725 by @silverwind Alternative to: https://github.com/go-gitea/gitea/pull/29698 Fixes: https://github.com/go-gitea/gitea/issues/29034 <img width="278" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/12ecd967-2723-410d-8a28-a1b0f41b7bba"> It also fixes a secondary issue that we were showing timestamp tooltips over date, which makes no sense, so these are now gone as well: <img width="284" alt="image" src="https://github.com/go-gitea/gitea/assets/115237/a70432f3-97b6-41e6-b202-b53b76924a66"> Co-authored-by: silverwind <me@silverwind.io>
* Fix inconsistent rendering of block mathematical expressions (#29677) (#29711)Giteabot2024-03-111-1/+2
| | | | | | | | | | | | | | | | | Backport #29677 by @yp05327 Fix #28735 GitHub render `\```math\``` ` as a block now. Add `display` class will render it as a block. After: ![image](https://github.com/go-gitea/gitea/assets/18380374/2a1c20c7-438e-4ab1-8c66-cf91c8343087) ![image](https://github.com/go-gitea/gitea/assets/18380374/b81b8a93-8bca-46a5-b7db-e0d2f53e1342) Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix: rendering internal file links in org (#29669) (#29705)Giteabot2024-03-102-4/+38
| | | | | | | | | | | Backport #29669 by @ankitrgadiya The internal links to other files in the repository were not rendering with the Src Prefix (/src/branch-name/file-path). This commit fixes that by using the `SrcLink` as base if available. Resolves #29668 Co-authored-by: Ankit R Gadiya <git@argp.in>
* Fix incorrect rendering csv file when file size is larger than ↵Giteabot2024-03-081-2/+4
| | | | | | | | | UI.CSV.MaxFileSize (#29653) (#29663) Backport #29653 by @yp05327 Fix #29506 Co-authored-by: yp05327 <576951401@qq.com>
* Use strict protocol check when redirect (#29642) (#29644)Giteabot2024-03-071-1/+1
| | | | | Backport #29642 by wxiaoguang Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Avoid unexpected panic in graceful manager (#29629) (#29630)wxiaoguang2024-03-062-2/+18
| | | Backport #29629
* Fix wrong line number in code search result (#29260) (#29623)Giteabot2024-03-061-19/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | Backport #29260 by @yp05327 Fix #29136 Before: The result is a table and all line numbers are all in one row. ![image](https://github.com/go-gitea/gitea/assets/18380374/7a18b354-e257-4f57-a5ca-f6d37378edf6) ![image](https://github.com/go-gitea/gitea/assets/18380374/98416e11-89b5-4b4f-920b-91bcf041a87f) After: ![image](https://github.com/go-gitea/gitea/assets/18380374/f189e436-9046-4431-926a-cd0deb58e8f1) ![image](https://github.com/go-gitea/gitea/assets/18380374/07d213ed-2401-4b7f-b951-5df7dc776af4) ~~Updated:~~ ~~added `active` class to the target line.~~ ![image](https://github.com/go-gitea/gitea/assets/18380374/0b274e48-048a-4c66-ba95-df515212ec08) Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make "/user/login" page redirect if the current user has signed in (#29583) ↵wxiaoguang2024-03-051-1/+2
| | | | | (#29599) Backport #29583
* Add a trailing slash to dashboard links (#29555) (#29573)wxiaoguang2024-03-043-3/+7
| | | Backport #29555
* Fix incorrect cookie path for AppSubURL (#29534) (#29552)Giteabot2024-03-031-2/+5
| | | | | | Backport #29534 Regression of #24107 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix queue worker incorrectly stopped when there are still more items in the ↵Giteabot2024-03-023-9/+42
| | | | | | | | | | | queue (#29532) (#29546) Backport #29532 Without `case <-t.C`, the workers would stop incorrectly, the test won't pass. For the worse case, there might be only one running worker processing the queue items for long time because other workers are stopped. The root cause is related to the logic of doDispatchBatchToWorker. It isn't a serious problem at the moment, so keep it as-is.
* Fix issue link does not support quotes (#29484) (#29487) (#29536)Giteabot2024-03-022-2/+6
| | | | | | | | | Backport #29487 by @charles7668 Close #29484 ![圖片](https://github.com/go-gitea/gitea/assets/30816317/b27e6e16-67e0-469c-8e04-30180c585890) Co-authored-by: charles <30816317+charles7668@users.noreply.github.com>
* Set pre-step status to `skipped` if job is skipped (#29489) (#29523)Giteabot2024-03-011-0/+3
| | | | | | | | | | | | | | | | | | | Backport #29489 by @sillyguodong close #27496 1. Set pre-step (Set up job) status to `skipped` if job is skipped. 2. Apart from pre-step, the other steps should also be set to `skipped`. The status of other steps are reported from the runner side. This will be completed by this PR: https://gitea.com/gitea/act_runner/pulls/500 before: ![image](https://github.com/go-gitea/gitea/assets/33891828/4bac2ba9-66de-4679-b7ed-fbae459c0c54) after: ![image](https://github.com/go-gitea/gitea/assets/33891828/ead4871a-4e0f-4bb1-9fb4-37f4fdb78dfc) Co-authored-by: sillyguodong <33891828+sillyguodong@users.noreply.github.com>
* Fix wrong test usage of `AppSubURL` (#29459) (#29488)Giteabot2024-02-291-22/+17
| | | | | | | | Backport #29459 by @KN4CK3R The tests use an invalid `setting.AppSubURL`. The wrong behaviour disturbs other PRs like #29222 and #29427. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix workflow trigger event bugs (#29467) (#29475)Giteabot2024-02-281-0/+3
| | | | | | | | | | Backport #29467 by @Zettat123 1. Fix incorrect `HookEventType` for issue-related events in `IssueChangeAssignee` 2. Add `case "types"` in the `switch` block in `matchPullRequestEvent` to avoid warning logs Co-authored-by: Zettat123 <zettat123@gmail.com>
* Do not double close reader (#29354) (#29370)Giteabot2024-02-241-1/+11
| | | | | | | | Backport #29354 by @KN4CK3R Fixes #29346 Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove SSH workaround (#27893) (#29332)65432024-02-221-7/+2
| | | | | | | | | Backport #27893 - Update github.com/gliderlabs/ssh to include https://github.com/gliderlabs/ssh/commit/02f9d573009f8c13755b6b90fa14a4f549b17b22. - Resolves https://codeberg.org/forgejo/forgejo/issues/1230 Co-authored-by: Earl Warren <109468362+earl-warren@users.noreply.github.com>
* Only log error when tag sync fails (#29295) (#29327)Giteabot2024-02-221-1/+3
| | | | | | | | | | | Backport #29295 by @lunny Fix #28843 This PR will bypass the pushUpdateTag to database failure when syncAllTags. An error log will be recorded. Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Use general token signing secret (#29205) (#29325)wxiaoguang2024-02-229-59/+125
| | | | | Backport #29205 (including #29172) Use a clearly defined "signing secret" for token signing.
* Improve the `issue_comment` workflow trigger event (#29277) (#29322)Giteabot2024-02-222-0/+50
| | | | | | | | | | | | | | | | | | | | | Backport #29277 by @Zettat123 Fix #29175 Replace #29207 This PR makes some improvements to the `issue_comment` workflow trigger event. 1. Fix the bug that pull requests cannot trigger `issue_comment` workflows 2. Previously the `issue_comment` event only supported the `created` activity type. This PR adds support for the missing `edited` and `deleted` activity types. 3. Some events (including `issue_comment`, `issues`, etc. ) only trigger workflows that belong to the workflow file on the default branch. This PR introduces the `IsDefaultBranchWorkflow` function to check for these events. Co-authored-by: Zettat123 <zettat123@gmail.com>
* Discard unread data of `git cat-file` (#29297) (#29310)Giteabot2024-02-2210-80/+66
| | | | | | | | | | | | Backport #29297 by @KN4CK3R Fixes #29101 Related #29298 Discard all read data to prevent misinterpreting existing data. Some discard calls were missing in error cases. Co-authored-by: KN4CK3R <admin@oldschoolhack.me> Co-authored-by: yp05327 <576951401@qq.com>
* Implement some action notifier functions (#29173) (#29308)yp053272024-02-222-4/+8
| | | | | | | | | | | | | Backport #29173 Fix #29166 Add support for the following activity types of `pull_request` - assigned - unassigned - review_requested - review_request_removed - milestoned - demilestoned
* Prevent double use of `git cat-file` session. (#29298) (#29301)KN4CK3R2024-02-221-6/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #29298 Fixes the reason why #29101 is hard to replicate. Related #29297 Create a repo with a file with minimum size 4097 bytes (I use 10000) and execute the following code: ```go gitRepo, err := gitrepo.OpenRepository(db.DefaultContext, <repo>) assert.NoError(t, err) commit, err := gitRepo.GetCommit(<sha>) assert.NoError(t, err) entry, err := commit.GetTreeEntryByPath(<file>) assert.NoError(t, err) b := entry.Blob() // Create a reader r, err := b.DataAsync() assert.NoError(t, err) defer r.Close() // Create a second reader r2, err := b.DataAsync() assert.NoError(t, err) // Should be no error but is ErrNotExist defer r2.Close() ``` The problem is the check in `CatFileBatch`: https://github.com/go-gitea/gitea/blob/79217ea63c1f77de7ca79813ae45950724e63d02/modules/git/repo_base_nogogit.go#L81-L87 `Buffered() > 0` is used to check if there is a "operation" in progress at the moment. This is a problem because we can't control the internal buffer in the `bufio.Reader`. The code above demonstrates a sequence which initiates an operation for which the code thinks there is no active processing. The second call to `DataAsync()` therefore reuses the existing instances instead of creating a new batch reader.
* Always write proc-receive hook for all git versions (#29287) (#29291)wxiaoguang2024-02-211-7/+5
| | | Backport #29287
* Refactor git version functions and check compatibility (#29155) (#29157)wxiaoguang2024-02-173-31/+80
| | | | | | Backport #29155 with an extra change: tolerate the git 2.43.1 GIT_FLUSH bug in Gitea 1.21.x, more details in the comment of repo_attribute.go Manually tested with git 2.43.1 and an old git (2.39.2)
* Refactor parseSignatureFromCommitLine (#29054) (#29108)wxiaoguang2024-02-098-149/+104
| | | | | | | Backport #29054. Fix #28840 This backport is for 1.21 only and it is different from the change in 1.22: this backport still accept the legacy date format to avoid breaking.
* Improve user experience for outdated comments (#29050) (#29086)Giteabot2024-02-081-2/+13
| | | | | | | | | | | | | | Backport #29050 by wxiaoguang Try to improve #28949 1. Make `ctx.Data["ShowOutdatedComments"] = true` by default: it brings consistent user experience, and sometimes the "outdated (source changed)" comments are still valuable. 2. Show a friendly message if the comment won't show, then the end users won't fell that "the comment disappears" (it is the special case when `ShowOutdatedComments = false`) Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix orgmode link resolving (#29024) (#29076)wxiaoguang2024-02-072-41/+43
| | | | | | | | Backport #29024 Also backport #27968 (remove unnecessary titles) Fix #28974 Add some new tests and fix some legacy unclear tests.
* fix: Elasticsearch: Request Entity Too Large #28117 (#29062) (#29075)Giteabot2024-02-071-5/+11
| | | | | | | | | | | Backport #29062 by @inferno-umar Fix for gitea putting everything into one request without batching and sending it to Elasticsearch for indexing as issued in #28117 This issue occured in large repositories while Gitea tries to index the code using ElasticSearch. Co-authored-by: dark-angel <70754989+inferno-umar@users.noreply.github.com>
* Fix an actions schedule bug (#28942) (#28999)Giteabot2024-01-311-0/+35
| | | | | | | | | | | | | | | Backport #28942 by @Zettat123 In #28691, schedule plans will be deleted when a repo's actions unit is disabled. But when the unit is enabled, the schedule plans won't be created again. This PR fixes the bug. The schedule plans will be created again when the actions unit is re-enabled --------- Co-authored-by: Zettat123 <zettat123@gmail.com> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Don't remove all mirror repository's releases when mirroring (#28817) (#28939)Giteabot2024-01-312-6/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Backport #28817 by @lunny Fix #22066 # Purpose This PR fix the releases will be deleted when mirror repository sync the tags. # The problem In the previous implementation of #19125. All releases record in databases of one mirror repository will be deleted before sync. Ref: https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481 # The Pros This PR introduced a new method which will load all releases from databases and all tags on git data into memory. And detect which tags needs to be inserted, which tags need to be updated or deleted. Only tags releases(IsTag=true) which are not included in git data will be deleted, only tags which sha1 changed will be updated. So it will not delete any real releases include drafts. # The Cons The drawback is the memory usage will be higher than before if there are many tags on this repository. This PR defined a special release struct to reduce columns loaded from database to memory. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Preserve BOM in web editor (#28935) (#28959)Giteabot2024-01-274-122/+58
| | | | | | | | | | | | | | | | | | | | | | | Backport #28935 by @silverwind The `ToUTF8*` functions were stripping BOM, while BOM is actually valid in UTF8, so the stripping must be optional depending on use case. This does: - Add a options struct to all `ToUTF8*` functions, that by default will strip BOM to preserve existing behaviour - Remove `ToUTF8` function, it was dead code - Rename `ToUTF8WithErr` to `ToUTF8` - Preserve BOM in Monaco Editor - Remove a unnecessary newline in the textarea value. Browsers did ignore it, it seems but it's better not to rely on this behaviour. Fixes: https://github.com/go-gitea/gitea/issues/28743 Related: https://github.com/go-gitea/gitea/issues/6716 which seems to have once introduced a mechanism that strips and re-adds the BOM, but from what I can tell, this mechanism was removed at some point after that PR. Co-authored-by: silverwind <me@silverwind.io>
* Strip `/` from relative links (#28932) (#28952)Giteabot2024-01-272-4/+32
| | | | | | | | | | | Backport #28932 by @KN4CK3R Fixes #28915 Restores the old behaviour: https://github.com/go-gitea/gitea/pull/26745/files#diff-d78a9d361b1fddc12218e4dd42f42d39d6be1fda184041e06bb6fb30f0d94c59L96 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Update go dependencies and fix go-git (#28893) (#28934)65432024-01-262-2/+11
| | | Backport #28893
* Respect branch info for relative links (#28909) (#28922)Giteabot2024-01-252-2/+4
| | | | | | | Backport #28909 by @KN4CK3R Fix #28904 Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix sort bug on repository issues list (#28897) (#28901)Giteabot2024-01-231-2/+2
| | | | | | | Backport #28897 by @lunny Fix #28896 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
* Prevent anonymous container access if `RequireSignInView` is enabled ↵Giteabot2024-01-221-1/+1
| | | | | | | | | | | (#28877) (#28882) Backport #28877 by @KN4CK3R Fixes #28875 If `RequireSignInView` is enabled, the ghost user has no access rights. Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
* Fix incorrect PostgreSQL connection string for Unix sockets (#28865) (#28870)Giteabot2024-01-212-2/+10
| | | | | | | Backport #28865 by @sdvcrx Fix #28864 Co-authored-by: sdvcrx <memory.silentvoyage@gmail.com>
* Warn that `DISABLE_QUERY_AUTH_TOKEN` is false only if it's explicitly ↵Giteabot2024-01-211-1/+4
| | | | | | | | | | | | | defined (#28783) (#28868) Backport #28783 by @yardenshoham So we don't warn on default behavior - Fixes https://github.com/go-gitea/gitea/issues/28758 - Follows https://github.com/go-gitea/gitea/pull/28390 Signed-off-by: Yarden Shoham <git@yardenshoham.com> Co-authored-by: Yarden Shoham <git@yardenshoham.com>