aboutsummaryrefslogtreecommitdiffstats
path: root/routers/web/repo
Commit message (Collapse)AuthorAgeFilesLines
* Add API routes to lock and unlock issues (#34165)HEADmainYaFou12 hours1-5/+0
| | | | | | | | | | | | | | | This pull request adds a GitHub-compatible API endpoint to lock and unlock an issue. The following routes exist now: - `PUT /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to lock an issue - `DELETE /api/v1/repos/{owner}/{repo}/issues/{id}/lock` to unlock an issue Fixes #33677 Fixes #20012 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix some trivial problems (#34237)wxiaoguang3 days1-6/+5
| | | | | | | 1. Using existing "content" variable in `swift.go` 2. Do not report 500 server error in `GetPullDiffStats` middleware, otherwise a PR missing ref won't be able to view. 3. Fix the abused "label button" when listing commits, there was too much padding space, see the screenshot below.
* Mark parent directory as viewed when all files are viewed (#33958)Kerwin Bryant6 days5-38/+140
| | | | | | | | Fix #25644 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix incorrect file links (#34189)wxiaoguang8 days5-11/+9
| | | | | | | | | | Fix #34188 The name "FileName" is ambiguous: sometimes it is "base name without path", sometimes it is "full name with path". The ambiguous name causes various problems. This PR clarifies the usage: `FileTreePath`: the full name with path.
* Refactor Git Attribute & performance optimization (#34154)Lunny Xiao10 days3-42/+31
| | | | | | | | | | | | | | | | This PR moved git attributes related code to `modules/git/attribute` sub package and moved language stats related code to `modules/git/languagestats` sub package to make it easier to maintain. And it also introduced a performance improvement which use the `git check-attr --source` which can be run in a bare git repository so that we don't need to create a git index file. The new parameter need a git version >= 2.40 . If git version less than 2.40, it will fall back to previous implementation. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: yp05327 <576951401@qq.com>
* refactor organization menu (#33928)Exploding Dragon11 days1-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fix missing items in organization menu. **Menu** <details> <summary>Show</summary> Before: ![](https://github.com/user-attachments/assets/bcbce97e-84de-44ea-9889-a664979433cd) After: ![](https://github.com/user-attachments/assets/a169e00f-5212-4733-af9e-e8676ad74376) </details> **Packages** <details> keep it consistent with the other pages. <summary>Show</summary> Before: ![](https://github.com/user-attachments/assets/170d7b3d-ecac-49b9-8296-44d0b0f2b191) After: ![](https://github.com/user-attachments/assets/9c3c6915-870c-48cc-8a35-3d615a27d36d) </details> --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* feat: Add sorting by exclusive labels (issue priority) (#33206)Thomas E Lackey11 days4-55/+65
| | | | | | | | | | | | | Fix #2616 This PR adds a new sort option for exclusive labels. For exclusive labels, a new property is exposed called "order", while in the UI options are populated automatically in the `Sort` column (see screenshot below) for each exclusive label scope. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Uniform all temporary directories and allow customizing temp path (#32352)Lunny Xiao13 days2-14/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This PR uniform all temporary directory usage so that it will be easier to manage. Relate to #31792 - [x] Added a new setting to allow users to configure the global temporary directory. - [x] Move all temporary files and directories to be placed under os.Temp()/gitea. - [x] `setting.Repository.Local.LocalCopyPath` now will be `setting.TempPath/local-repo` and the customized path is removed. ```diff -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;[repository.local] -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; -;; -;; Path for local repository copy. Defaults to TEMP_PATH + `local-repo`, this is deprecated and cannot be changed -;LOCAL_COPY_PATH = local-repo ``` - [x] `setting.Repository.Upload.TempPath` now will be `settting.TempPath/uploads` and the customized path is removed. ```diff ;[repository.upload] -;; -;; Path for uploads. Defaults to TEMP_PATH + `uploads` -;TEMP_PATH = uploads ``` - [x] `setting.Packages.ChunkedUploadPath` now will be `settting.TempPath/package-upload` and the customized path is removed. ```diff ;[packages] -;; -;; Path for chunked uploads. Defaults it's `package-upload` under `TEMP_PATH` unless it's an absolute path. -;CHUNKED_UPLOAD_PATH = package-upload ``` - [x] `setting.SSH.KeyTestPath` now will be `settting.TempPath/ssh_key_test` and the customized path is removed. ```diff [server] -;; -;; Directory to create temporary files in when testing public keys using ssh-keygen, -;; default is the system temporary directory. -;SSH_KEY_TEST_PATH = ``` TODO: - [ ] setting.PprofDataPath haven't been changed because it may need to be kept until somebody read it but temp path may be clean up any time. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Check user/org repo limit instead of doer (#34147)DrMaxNix13 days3-22/+14
| | | | | | | | | | | | This PR tries to finally fix the bug mentioned in #30011 and #15504, where the user repo limit is checked when creating a repo in an organization. Fix #30011 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
* Keep file tree view icons consistent with icon theme (#33921)Kerwin Bryant2025-04-063-3/+17
| | | | | | | | | | | | | | | | | 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>
* Correctly handle submodule view and avoid throwing 500 error (#34121)wxiaoguang2025-04-062-0/+59
| | | | Auto-redirect for in-site links, and show 404 for external links (to avoid open redirect or phishing)
* Fix markdown render behaviors (#34122)wxiaoguang2025-04-053-4/+4
| | | | | | | * Fix #27645 * Add config options `MATH_CODE_BLOCK_DETECTION`, problematic syntaxes are disabled by default * Fix #33639 * Add config options `RENDER_OPTIONS_*`, old behaviors are kept
* Avoid creating unnecessary temporary cat file sub process (#33942)Lunny Xiao2025-04-041-15/+23
| | | | | | | | | | | | | 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.
* Refactor Branch struct in package modules/git (#33980)Lunny Xiao2025-04-022-6/+5
| | | | The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
* Support creating relative link to raw path in markdown (#34105)wxiaoguang2025-04-031-1/+14
| | | Fix #34104
* Do not show 500 error when default branch doesn't exist (#34096)wxiaoguang2025-04-012-3/+23
| | | Fix #34090
* Enable addtional linters (#34085)TheFox0x72025-04-0110-33/+34
| | | | | | | | enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add flat-square action badge style (#34062)bytedream2025-04-011-11/+14
| | | | | | | | | Adds the `flat-square` style to action badges. Styles can be selected by adding `?style=<style>` to the badge endpoint. If no style query is given, or if the query is invalid, the style defaults to `flat`. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* fix users being able bypass limits with repo transfers (#34031)TheFox0x72025-03-312-3/+10
| | | | prevent user from being able to transfer repo to user who cannot have more repositories
* Enable testifylint rules (#34075)TheFox0x72025-03-315-34/+34
| | | | 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-301-1/+1
| | | | | | | | | | | 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 ```
* enable staticcheck QFxxxx rules (#34064)TheFox0x72025-03-294-10/+14
|
* Add anonymous access support for private/unlisted repositories (#34051)wxiaoguang2025-03-292-85/+204
| | | | | | | | | | | 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)
* Hide activity contributors, recent commits and code frequrency left tabs if ↵Lunny Xiao2025-03-282-16/+1
| | | | | | | | | | | there is no code permission (#34053) When a team have no code unit permission of a repository, the member of the team should not view activity contributors, recent commits and code frequrency. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add anonymous access support for private repositories (backend) (#33257)wxiaoguang2025-03-281-709/+805
| | | | | | | | | | | 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"
* fix org repo creation being limited by user limits (#34030)TheFox0x72025-03-271-2/+2
| | | | | | | | | | | fixes an issue where user is unable to create new repository in organization via UI if repository limits are in place and user has exhausted them for their own namespace. closes: https://github.com/go-gitea/gitea/issues/15504 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Download actions job logs from API (#33858)Lunny Xiao2025-03-261-39/+9
| | | | | | | | | | | | | | Related to #33709, #31416 It's similar with https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#download-job-logs-for-a-workflow-run--code-samples. This use `job_id` as path parameter which is consistent with Github's APIs. --------- Co-authored-by: ChristopherHX <christopher.homberger@web.de> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Prepare common tmpl functions in a middleware (#33957)wxiaoguang2025-03-251-38/+0
| | | | Fix the TODO in `routers/web/web.go`, and avoid the unnecessary `GetActiveStopwatch` SQL query in non-related route handlers.
* Auto expand "New PR" form (#33971)wxiaoguang2025-03-242-14/+22
| | | Follow GitHub's behavior: use `?expand=1` to expand the "New PR" form
* Allow filtering issues by any assignee (#33343)Andreas Svanberg2025-03-212-11/+11
| | | | | | | | | | | | | | | | This is the opposite of the "No assignee" filter, it will match all issues that have at least one assignee. Before ![Before change](https://github.com/user-attachments/assets/4aea194b-9add-4a84-8d6b-61bfd8d9e58e) After ![After change with any filter](https://github.com/user-attachments/assets/99f1205d-ba9f-4a0a-a60b-cc1a0c0823fe) --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Don't create duplicated functions for code repositories and wiki ↵Lunny Xiao2025-03-194-6/+6
| | | | | | | | | | 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.
* Move git references checking to gitrepo packages to reduce expose of ↵Lunny Xiao2025-03-156-11/+14
| | | | repository path (#33891)
* Add file tree to file view page (#32721)Kerwin Bryant2025-03-154-45/+64
| | | | | | | | | | | 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>
* Add abstraction layer to delete repository from disk (#33879)Lunny Xiao2025-03-141-4/+5
| | | | Extract from #28966 Follow #33874
* Improve repo commit view (#33877)wxiaoguang2025-03-141-0/+11
| | | | | | | | | | | | | | | | | Fix #24623 Major changes: 1. Redirect `/owner/repo/blob/*` requests to `/owner/repo/src/commit/*` (like GitHub) 2. Add a "view file diff" link (see screenshot below) 3. Refactor "AssertHTMLElement" to generic, now we can accurately assert existence or number. 4. Add more tests --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: delvh <dev.lh@web.de>
* Pull request updates will also trigger code owners review requests (#33744)Lunny Xiao2025-03-131-2/+1
| | | | | | | | | | 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>
* Improve issue & code search (#33860)wxiaoguang2025-03-131-5/+5
| | | | Each "indexer" should provide the "search modes" they support by themselves. And we need to remove the "fuzzy" search for code.
* Refactor cache-control (#33861)wxiaoguang2025-03-132-5/+5
| | | And fix #21391
* Add workflow_job webhook (#33694)ChristopherHX2025-03-112-1/+26
| | | | | | | | | 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-101-2/+1
| | | | | | | | * 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-101-1/+0
|
* Full-file syntax highlighting for diff pages (#33766)Dustin Firebaugh2025-03-094-4/+4
| | | | | | | | | | | | 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>
* Decouple diff stats query from actual diffing (#33810)wxiaoguang2025-03-084-29/+37
| | | | | | | | | 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
* Use correct start and end commits for GetDiffTree (#33816)Alexander McRae2025-03-071-1/+1
| | | | | | Fixes https://github.com/go-gitea/gitea/pull/33514#issuecomment-2702814099 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor: move part of updating protected branch logic to service layer (#33742)Lunny Xiao2025-03-051-17/+3
|
* Remove context from git struct (#33793)TheFox0x72025-03-042-10/+10
| | | | Argument is moved from struct init in command run, which lets us remove context from struct.
* Refactor error system (#33771)wxiaoguang2025-03-031-1/+1
| | | It should not expose `util.SilentWrap` or construct it manually.
* Use `git diff-tree` for `DiffFileTree` on diff pages (#33514)Alexander McRae2025-02-284-0/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Modify Diff View FileTree to show all files ## Changes * removes Show Status button on diff * uses `git diff-tree` to generate the file tree for the diff * doesn't reload the diff tree each time we load more files in the preview * selecting and unloaded file will keep loading until that file is loaded * removes `DiffFileList.vue` and "Show Stats" in diff options ## Open Questions * selecting and unloaded file will keep loading until that file is loaded. Is this behaviour okay? It matches what github does. ### Demo In this demo I set `git.MAX_GIT_DIFF_FILES=1` in my `app.ini` to demonstrate a worst case example. In most cases the behaviour isn't nearly as jarring as we load a bunch of files at a time. https://github.com/user-attachments/assets/72f29663-d6fc-472d-94fa-7fb5950c2836 --------- Co-authored-by: silverwind <me@silverwind.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix git empty check and HEAD request (#33690)wxiaoguang2025-02-241-1/+1
|
* Fix Untranslated Text on Actions Page (#33635)Kerwin Bryant2025-02-181-1/+1
| | | | | Fix the problem of untranslated text on the actions page Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>