aboutsummaryrefslogtreecommitdiffstats
path: root/services
Commit message (Collapse)AuthorAgeFilesLines
...
* Keep file tree view icons consistent with icon theme (#33921)Kerwin Bryant2025-04-062-11/+46
| | | | | | | | | | | | | | | | | Fix #33914 before: ![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test gitea_src_branch_main_ gitmodules](https://github.com/user-attachments/assets/ca50eeff-cc44-4041-b01f-c0c5bdd3b6aa) after: ![3000-gogitea-gitea-y4ulxr46c4k ws-us118 gitpod io_test_test gitea_src_branch_main_README md](https://github.com/user-attachments/assets/3b87fdbd-81d0-4831-8a74-4dbfcd5b6d91) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Remove dead code: RepoRef (#34131)wxiaoguang2025-04-061-6/+0
| | | The RepoRef is a no-op since Refactor ref type (#33242) (Jan 14)
* Avoid creating unnecessary temporary cat file sub process (#33942)Lunny Xiao2025-04-041-1/+1
| | | | | | | | | | | | | Extract from #33934 In the same goroutine, we should reuse the exist cat file sub process which exist in `git.Repository` to avoid creating a unnecessary temporary subprocess. This PR reuse the exist cate file writer and reader in `getCommitFromBatchReader`. It also move `prepareLatestCommitInfo` before creating dataRc which will hold the writer so other git operation will create a temporary cat file subprocess.
* Fix discord webhook 400 status code when description limit is exceeded (#34084)Mopcho2025-04-041-1/+8
| | | | | | | | | | | | Fixes [#34027](https://github.com/go-gitea/gitea/issues/34027) Discord does not allow for description bigger than 2048 bytes. If the description is bigger than that it will throw 400 and the event won't appear in discord. To fix that, in the createPayload method we now slice the description to ensure it doesn’t exceed the limit. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix invalid version in RPM package path (#34112)KN4CK3R2025-04-031-2/+1
|
* Add `last_committer_date` and `last_author_date` for file contents API (#32921)Lunny Xiao2025-04-023-24/+38
| | | | | | | | Fix #32886 Add `last_committer_date` and `last_author_date` in the content API which is not implemented by Github API v3 at the moment. Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor Branch struct in package modules/git (#33980)Lunny Xiao2025-04-027-45/+39
| | | | The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
* Do not show 500 error when default branch doesn't exist (#34096)wxiaoguang2025-04-011-1/+1
| | | Fix #34090
* Move ParseCommitWithSSHSignature to service layer (#34087)Lunny Xiao2025-04-011-1/+65
| | | No code change.
* Enable addtional linters (#34085)TheFox0x72025-04-0169-161/+186
| | | | | | | | enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix users being able bypass limits with repo transfers (#34031)TheFox0x72025-03-312-1/+63
| | | | prevent user from being able to transfer repo to user who cannot have more repositories
* Improve pull request list api (#34052)Lunny Xiao2025-03-311-56/+27
| | | | | | | | The pull request list API is slow, for every pull request, it needs to open a git repository. Assume it has 30 records, there will be 30 sub processes back because every repository will open a git cat-file --batch sub process. This PR use base git repository to get the head commit id rather than read it from head repository to avoid open any head git repository.
* Enable testifylint rules (#34075)TheFox0x72025-03-3137-114/+114
| | | | enable testifylint rules disabled in: https://github.com/go-gitea/gitea/pull/34054
* Add a config option to block "expensive" pages for anonymous users (#34024)wxiaoguang2025-03-302-2/+2
| | | | | | | | | | | Fix #33966 ``` ;; User must sign in to view anything. ;; It could be set to "expensive" to block anonymous users accessing some pages which consume a lot of resources, ;; for example: block anonymous AI crawlers from accessing repo code pages. ;; The "expensive" mode is experimental and subject to change. ;REQUIRE_SIGNIN_VIEW = false ```
* add additional ReplaceAll in pathsep to cater for different pathsep (#34061)JonRB2025-03-301-1/+1
| | | | | | | | | | | | | | The doctor storage check reconstructs the lfs oid by producing a string where the path separator is stripped ab/dc/efg -> abdcefg. Windows however uses a backslash and thus the ReplaceAll call doesn't produce the correct oid resulting in all lfs objects being classed as orphaned. This PR allows this to be more OS agnostic. Closes #34039 --------- Co-authored-by: Giteabot <teabot@gitea.io>
* enable staticcheck QFxxxx rules (#34064)TheFox0x72025-03-296-26/+34
|
* Add anonymous access support for private/unlisted repositories (#34051)wxiaoguang2025-03-291-8/+5
| | | | | | | | | | | Follow #33127 Fix #8649, fix #639 This is a complete solution. A repo unit could be set to: * Anonymous read (non-signed-in user) * Everyone read (signed-in user) * Everyone write (wiki-only)
* Add anonymous access support for private repositories (backend) (#33257)wxiaoguang2025-03-281-1/+1
| | | | | | | | | | | Follow #33127 This PR add backend logic and test for "anonymous access", it shares the same logic as "everyone access", so not too much change. By the way, split `SettingsPost` into small functions to make it easier to make frontend-related changes in the future. Next PR will add frontend support for "anonymous access"
* Fail mirroring more gracefully (#34002)Royce Remer2025-03-262-11/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * reuse recoverable error checks across mirror_pull * add new cases for 'cannot lock ref/not our ref' (race condition in fetch) and 'Unable to create/lock" * move lfs sync right after commit graph write, and before other maintenance which may fail * try a prune for 'broken reference' as well as 'not our ref' * always sync LFS right after commit graph write, and before other maintenance which may fail This handles a few cases where our very large and very active repositories could serve mirrored git refs, but be missing lfs files: ## Case 1 (multiple variants): Race condition in git fetch There was already a check for 'unable to resolve reference' on a failed git fetch, after which a git prune and then subsequent fetch are performed. This is to work around a race condition where the git remote tells Gitea about a ref for some HEAD of a branch, then fails a few seconds later because the remote branch was deleted, or the ref was updated (force push). There are two more variants to the error message you can get, but for the same kind of race condition. These *may* be related to the git binary version Gitea has access to (in my case, it was 2.48.1). ## Case 2: githttp.go can serve updated git refs before it's synced lfs oids There is probably a more aggressive refactor we could do here to have the cat-file loop use FETCH_HEAD instead of relying on the commit graphs to be committed locally (and thus serveable to clients of Gitea), but a simple reduction in the occurrences of this for me was to move the lfs sync block immediately after the commit-graph write and before any other time-consuming (or potentially erroring/exiting) blocks. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Git client will follow 301 but 307 (#34005)Lunny Xiao2025-03-251-1/+3
| | | | | | | Fix #28460 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix some migration and repo name problems (#33986)wxiaoguang2025-03-244-9/+22
| | | | | | 1. Ignore empty inputs in `UnmarshalHandleDoubleEncode` 2. Ignore non-existing `stateEvent.User` in gitlab migration 3. Enable `release` and `wiki` units when they are selected in migration 4. Sanitize repo name for migration and new repo
* Use filepath.Join instead of path.Join for file system file operations (#33978)Lunny Xiao2025-03-242-5/+5
|
* Only use prev and next buttons for pagination on user dashboard (#33981)Lunny Xiao2025-03-232-10/+9
| | | | | | | | | | | The pagination on the user dashboard sounds unnecessary, this will change it to a prev/next buttons. For instances with around `10 million` records in the action table, this option affects how the user dashboard is loaded on first visit. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: Giteabot <teabot@gitea.io>
* Optimize total count of feed when loading activities in user dashboard. (#33841)Lunny Xiao2025-03-201-0/+26
| | | | | | | | | | | | Two SQLs are very slow when `action` table have over 5M records. ``` database duration=1.8881s db.sql="SELECT created_unix DIV 900 * 900 AS timestamp, count(user_id) as contributions FROM `action` WHERE user_id=? AND act_user_id=? AND (created_unix > ?) GROUP BY timestamp ORDER BY timestamp" database duration=1.5408s db.sql="SELECT count(*) FROM `action` WHERE (user_id = ?) AND (is_deleted = ?)" ``` This will cache the count for the first loading or when the activities changed.
* Extract code to their own functions for push update (#33944)Lunny Xiao2025-03-201-86/+111
|
* Don't create duplicated functions for code repositories and wiki ↵Lunny Xiao2025-03-1910-20/+21
| | | | | | | | | | repositories (#33924) Fix https://github.com/go-gitea/gitea/pull/33910#pullrequestreview-2688913865 This PR changed the Repositroy interface in `gitrepo` package which makes it only focus the relative path in the disk and abstract whether it's a wiki repository or not.
* Added Description Field for Secrets and Variables (#33526)John Smith2025-03-173-10/+12
| | | | | | | Fixes #33484 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Try to figure out attribute checker problem (#33901)wxiaoguang2025-03-171-0/+2
| | | For #31600
* Move hooks function to gitrepo and reduce expose repopath (#33890)Lunny Xiao2025-03-166-16/+13
| | | | Extract from #28966 Follow #33874
* Refactor functions to reduce repopath expose (#33892)Lunny Xiao2025-03-162-5/+5
|
* Move git references checking to gitrepo packages to reduce expose of ↵Lunny Xiao2025-03-1511-23/+25
| | | | repository path (#33891)
* Add lock for a repository pull mirror (#33876)Lunny Xiao2025-03-151-0/+12
| | | | | Fix #33647 This PR add a global lock for repository pulling mirror.
* Add file tree to file view page (#32721)Kerwin Bryant2025-03-153-11/+163
| | | | | | | | | | | Resolve #29328 This pull request introduces a file tree on the left side when reviewing files of a repository. --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Feature: Ephemeral action runners (#33570)ChristopherHX2025-03-142-1/+46
| | | | | | | | * This includes a runner mock test for hardend PickTask behavior like described in my proposal * Runner register ephemeral flag introduced in https://gitea.com/gitea/act_runner/pulls/649 Closes #32461
* Add abstraction layer to delete repository from disk (#33879)Lunny Xiao2025-03-144-6/+12
| | | | Extract from #28966 Follow #33874
* Ignore trivial errors when updating push data (#33864)wxiaoguang2025-03-142-18/+20
| | | Fix #23213
* Add abstraction layer to check if the repository exists on disk (#33874)Lunny Xiao2025-03-144-39/+32
| | | | | | | | | | Extract from #28966 This PR uses `gitrepo.IsRepositoryExist` instead of `util.IsExist` to detect whether the repository exist in disk. This will move `RepoPath` detail behind of package `gitrepo` to make it easier to do possible changes where storing the repositories. No code change
* Pull request updates will also trigger code owners review requests (#33744)Lunny Xiao2025-03-136-32/+117
| | | | | | | | | | Fix #33490 It will only read the changed file on the pushed commits but not all the files of this PR. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* remove context from retry downloader (#33871)TheFox0x72025-03-141-1/+1
| | | | follow up to https://github.com/go-gitea/gitea/pull/33399 as I apparently missed this one.
* Refactor cache-control (#33861)wxiaoguang2025-03-132-2/+2
| | | And fix #21391
* Add workflow_job webhook (#33694)ChristopherHX2025-03-1122-3/+268
| | | | | | | | | Provide external Integration information about the Queue lossly based on https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=completed#workflow_job Naming conflicts between GitHub & Gitea are here, Blocked => Waiting, Waiting => Queued Rationale Enhancement for ephemeral runners management #33570
* Fix auto concurrency cancellation skips commit status updates (#33764)ChristopherHX2025-03-106-10/+30
| | | | | | | | * add missing commit status * conflicts with concurrency support Closes #33763 Co-authored-by: Giteabot <teabot@gitea.io>
* Fix material icon & diff highlight (#33844)wxiaoguang2025-03-104-26/+61
|
* Move notifywatch to service layer (#33825)Lunny Xiao2025-03-103-19/+183
| | | No logic change.
* Only keep popular licenses (#33832)wxiaoguang2025-03-103-50/+11
| | | Fix #33467
* Full-file syntax highlighting for diff pages (#33766)Dustin Firebaugh2025-03-095-285/+318
| | | | | | | | | | | | Fix #33358, fix #21970 This adds a step in the `GitDiffForRender` that does syntax highlighting for the entire file and then only references lines from that syntax highlighted code. This allows things like multi-line comments to be syntax highlighted correctly. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Improve theme display (#30671)wxiaoguang2025-03-082-22/+151
| | | | | | Document: https://gitea.com/gitea/docs/pulls/180 ![image](https://github.com/go-gitea/gitea/assets/2114189/68e38573-b911-45d9-b7aa-40d96d836ecb)
* Decouple context from repository related structs (#33823)TheFox0x72025-03-088-96/+95
| | | Calls that required context implicitly are made to pass it as argument
* Improve log format (#33814)wxiaoguang2025-03-083-6/+6
|
* Decouple diff stats query from actual diffing (#33810)wxiaoguang2025-03-086-135/+70
| | | | | | | | | The diff stats are no longer part of the diff generation. Use `GetDiffShortStat` instead to get the total number of changed files, added lines, and deleted lines. As such, `gitdiff.GetDiff` can be simplified: It should not do more than expected. And do not run "git diff --shortstat" for pull list. Fix #31492