aboutsummaryrefslogtreecommitdiffstats
path: root/modules/git
Commit message (Collapse)AuthorAgeFilesLines
* Follow file symlinks in the UI to their target (#28835)delvh6 days10-147/+134
| | | | | | | | | | Symlinks are followed when you click on a link next to an entry, either until a file has been found or until we know that the link is dead. When the link cannot be accessed, we fall back to the current behavior of showing the document containing the target. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add support for 3D/CAD file formats preview (#34794)Kerwin Bryant7 days1-9/+12
| | | | | | | Fix #34775 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor repo contents API and add "contents-ext" API (#34822)wxiaoguang12 days2-20/+25
| | | See the updated swagger document for details.
* Run `gopls modernize` on codebase (#34751)silverwind2025-06-1815-31/+23
| | | | Recent modernize fixes: https://github.com/golang/tools/commits/master/gopls/internal/analysis/modernize
* remove unnecessary duplicate code (#34733)Lunny Xiao2025-06-171-30/+5
|
* Improve instance wide ssh commit signing (#34341)ChristopherHX2025-06-115-4/+48
| | | | | | | | | | | | | | | | | * Signed SSH commits can look in the UI like on GitHub, just like gpg keys today in Gitea * SSH format can be added in gitea config * SSH Signing worked before with DEFAULT_TRUST_MODEL=committer `TRUSTED_SSH_KEYS` can be a list of additional ssh public key contents to trust for every user of this instance Closes #34329 Related #31392 --------- Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix some trivial problems (#34579)wxiaoguang2025-06-021-3/+11
|
* Refactor commit reader (#34542)wxiaoguang2025-05-274-84/+68
|
* Don't display error log when .git-blame-ignore-revs doesn't exist (#34457)Lunny Xiao2025-05-261-18/+22
| | | Fix #34454
* feat(api): add date range filtering to commit retrieval endpoints (#34497)Bo-Yi Wu2025-05-193-5/+25
| | | | | | | | | | | | | | | - Add support for filtering commits by date range via new "since" and "until" parameters - Update API endpoints and command logic to handle the new parameters for fetching commits within given dates - Extend API documentation and Swagger specs to describe the new "since" and "until" query parameters - Refactor related function signatures and implementations to accept and pass "since" and "until" values --------- Signed-off-by: appleboy <appleboy.tw@gmail.com> Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
* Fix a bug when uploading file via lfs ssh command (#34408)Lunny Xiao2025-05-091-0/+36
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix LFS file not stored in LFS when uploaded/edited via API or web UI (#34367)bytedream2025-05-082-2/+17
| | | | | | | | Files that should be stored in LFS and are uploaded/edited from the API or web UI aren't stored in LFS. This may be a regression from #34154. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* support the open-icon of folder (#34168)Kerwin Bryant2025-04-282-5/+30
| | | Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add API endpoint to request contents of multiple files simultaniously (#34139)Denys Konovalov2025-04-221-14/+0
| | | | | | | | | | | | | | | | Adds an API POST endpoint under `/repos/{owner}/{repo}/file-contents` which receives a list of paths and returns a list of the contents of these files. This API endpoint will be helpful for applications like headless CMS (reference: https://github.com/sveltia/sveltia-cms/issues/198) which need to retrieve a large number of files by reducing the amount of needed API calls. Close #33495 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor Git Attribute & performance optimization (#34154)Lunny Xiao2025-04-1119-484/+809
| | | | | | | | | | | | | | | | 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>
* Uniform all temporary directories and allow customizing temp path (#32352)Lunny Xiao2025-04-087-49/+57
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Keep file tree view icons consistent with icon theme (#33921)Kerwin Bryant2025-04-063-44/+30
| | | | | | | | | | | | | | | | | 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>
* Avoid creating unnecessary temporary cat file sub process (#33942)Lunny Xiao2025-04-044-11/+17
| | | | | | | | | | | | | 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-021-67/+0
| | | | The `Branch` struct in `modules/git` package is unnecessary. We can just use a `string` to represent a branch
* Enable addtional linters (#34085)TheFox0x72025-04-014-5/+6
| | | | | | | | enable mirror, usestdlibbars and perfsprint part of: https://github.com/go-gitea/gitea/issues/34083 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Fix some UI bugs and clean up unused tests (#34088)wxiaoguang2025-04-011-60/+0
| | | | | 1. Make the material icon falls back to basic theme correctly 2. Remove `TestAttributeReader`, the problem has been resolved. 3. Fix `toggleElem` bug and add tests
* Enable testifylint rules (#34075)TheFox0x72025-03-3114-80/+70
| | | | enable testifylint rules disabled in: https://github.com/go-gitea/gitea/pull/34054
* enable staticcheck QFxxxx rules (#34064)TheFox0x72025-03-294-19/+26
|
* Decouple Batch from git.Repository to simplify usage without requiring the ↵Lunny Xiao2025-03-272-10/+11
| | | | | creation of a Repository struct. (#34001) No logic change
* Fix the issue with error message logging for the `check-attr` command on ↵charles2025-03-271-1/+2
| | | | | | | | | | Windows OS. (#34035) Close #34022 , #33550 This error message always appears when using the `check-attr` command, even though it works correctly. The issue occurs when the stdin writer is closed, so I added a special case to handle and check the error message when the exit code is 1.
* Try to fix check-attr bug (#34029)wxiaoguang2025-03-271-1/+1
|
* Move duplicated functions (#33977)Lunny Xiao2025-03-254-35/+35
| | | | Remove duplicated functions `IsExist`, `IsFile` and `IsDir` in package `modules/git` and use the exists functions in `modules/util`.
* Use filepath.Join instead of path.Join for file system file operations (#33978)Lunny Xiao2025-03-242-31/+4
|
* Try to figure out attribute checker problem (#33901)wxiaoguang2025-03-173-15/+94
| | | For #31600
* Move git references checking to gitrepo packages to reduce expose of ↵Lunny Xiao2025-03-151-6/+0
| | | | repository path (#33891)
* Add file tree to file view page (#32721)Kerwin Bryant2025-03-152-1/+2
| | | | | | | | | | | 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>
* Improve issue & code search (#33860)wxiaoguang2025-03-131-6/+22
| | | | Each "indexer" should provide the "search modes" they support by themselves. And we need to remove the "fuzzy" search for code.
* Fix material icon & diff highlight (#33844)wxiaoguang2025-03-101-3/+3
|
* Full-file syntax highlighting for diff pages (#33766)Dustin Firebaugh2025-03-091-9/+11
| | | | | | | | | | | | 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-081-11/+3
| | | | | | | | | 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
* Remove context from git struct (#33793)TheFox0x72025-03-0441-236/+226
| | | | Argument is moved from struct init in command run, which lets us remove context from struct.
* Use test context in tests and new loop system in benchmarks (#33648)TheFox0x72025-02-2014-49/+41
| | | | | | | | Replace all contexts in tests with go1.24 t.Context() --------- Co-authored-by: Giteabot <teabot@gitea.io> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Add go wrapper around git diff-tree --raw -r -M (#33369)Alexander McRae2025-02-072-14/+29
| | | | | * Implemented calling git diff-tree * Ensures wrapper function is called with valid arguments * Parses output into go struct, using strong typing when possible
* Link to tree views of submodules if possible (#33424)Rowan Bohde2025-01-302-4/+4
| | | | | | | | | | | | | | This is a follow-up to https://github.com/go-gitea/gitea/pull/33097. When linking a submodule at a commit in either the repo view, or a diff when adding a new submodule, link to the tree view of that submodules intead of the individual commit. This shows the user the full tree, instead of the diff of the commit. This makes the assumption that the tree for a given SHA is at `<repo_url>/tree/<sha>`. This URL format is supported by both Github & Gitlab, but not Gitea. To fix this, add a redirect from `<username>/<repo>/tree/<ref>` to `<username>/<repo>/src/<ref>`, so that Gitea can support this URL structure.
* Fix `GetCommitBranchStart` bug (#33298)Zettat1232025-01-282-5/+5
| | | | | | Fix #33265 Fix #33370 This PR also fixes some bugs in `TestGitGeneral`.
* Support performance trace (#32973)wxiaoguang2025-01-212-4/+10
| | | | | | | | | | | | | 1. Add a OpenTelemetry-like shim-layer to collect traces 2. Add a simple builtin trace collector and exporter, end users could download the diagnosis report to get the traces. This PR's design is quite lightweight, no hard-dependency, and it is easy to improve or remove. We can try it on gitea.com first to see whether it works well, and fine tune the details. --------- Co-authored-by: silverwind <me@silverwind.io>
* Fix typo in documentation of GetBranchNames() (#33330)Michael Vetter2025-01-191-1/+1
|
* Fix parentCommit invalid memory address or nil pointer dereference. (#33204)hiifong2025-01-191-2/+8
| | | | | | | | | When the parent Commit does not exist on gitea, an error will be reported when opening the Commit details page: invalid memory address or nil pointer dereference. ![image](https://github.com/user-attachments/assets/4c2a9802-935f-41e9-b5b9-a4f0d745f709) ![image](https://github.com/user-attachments/assets/7b0bc15e-7f5f-4d58-8d24-fee667a799fa)
* Refactor RefName (#33234)wxiaoguang2025-01-133-29/+38
| | | And fix some FIXMEs
* Refactor context RefName and RepoAssignment (#33226)wxiaoguang2025-01-133-19/+53
| | | | | | | The `ctx.Repo.RefName` was used to be a "short name", it causes a lot of ambiguity. This PR does some refactoring and use `RefFullName` to replace the legacy `RefName`, and simplify RepoAssignment
* Fix mirror bug (#33224)Lunny Xiao2025-01-121-0/+2
| | | | | Fix #33200 Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Refactor older tests to use testify (#33140)TheFox0x72025-01-095-19/+10
| | | | | Refactor checks to use assert/require Use require.Eventually for waiting in elastic and meilisearch tests Use require to exit early instead of assert
* add submodule diff links (#33097)Rowan Bohde2025-01-088-130/+255
| | | | | | | | | | | | This adds links to submodules in diffs, similar to the existing link when viewing a repo at a specific commit. It does this by expanding diff parsing to recognize changes to submodules, and find the specific refs that are added, deleted or changed. Related #25888 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Support the new exit code for `git remote` subcommands for git version ↵yp053272025-01-071-0/+9
| | | | | | | | | >=2.30.0 (#33129) Fix #32889 --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
* Make git clone URL could use current signed-in user (#33091)wxiaoguang2025-01-073-5/+8
| | | | | | | | | | | | | | close #33086 * Add a special value for "SSH_USER" setting: `(DOER_USERNAME)` * Improve parseRepositoryURL and add tests (now it doesn't have hard dependency on some setting values) Many changes are just adding "ctx" and "doer" argument to functions. By the way, improve app.example.ini, remove all `%(key)s` syntax, it only makes messy and no user really cares about it. Document: https://gitea.com/gitea/docs/pulls/138