0
0
mirror of https://github.com/go-gitea/gitea.git synced 2026-01-31 20:44:57 +01:00

5047 Commits

Author SHA1 Message Date
Lunny Xiao
2cbd55f155
Merge branch 'main' into lunny/some_refactors 2026-01-16 11:16:51 -08:00
TheFox0x7
69c5921d71
Add ability to download subpath archive (#36371)
closes: https://github.com/go-gitea/gitea/issues/4478

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-16 09:31:12 +00:00
Lunny Xiao
d61c3b15f5
Merge branch 'main' into lunny/some_refactors 2026-01-15 18:41:37 -08:00
Zeno
3f46de8265
Add chunked transfer encoding support for LFS uploads (#36380)
Enable chunked transfer encoding for Git LFS uploads by adding
Transfer-Encoding: chunked header to upload action responses. This
prevents large file uploads (100+ MB) from being blocked by reverse
proxies like Cloudflare that buffer non-chunked requests.

Fix https://github.com/go-gitea/gitea/issues/22233

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-16 07:15:18 +08:00
Lunny Xiao
733c5b608a
Merge branch 'main' into lunny/some_refactors 2026-01-14 09:25:47 -08:00
wxiaoguang
1c1a7b8492
Fix incorrect text content detection (#36364)
Fix #36325
2026-01-14 23:35:52 +08:00
Lunny Xiao
75c62ce562
test 2026-01-13 19:12:52 -08:00
Lunny Xiao
e4a568141b Merge branch 'lunny/some_refactors' of github.com:lunny/gitea into lunny/some_refactors 2026-01-13 17:20:48 -08:00
Lunny Xiao
791bd4325e
Fix parally problem 2026-01-13 17:20:30 -08:00
Lunny Xiao
95ea2df00a
Add more check for stopwatch read or list (#36340) 2026-01-13 13:13:39 +00:00
Lunny Xiao
81dacb14c9
Merge branch 'main' into lunny/some_refactors 2026-01-12 12:23:52 -08:00
silverwind
1d399bb1d1
Improve diff file headers (#36215)
- reduce file name font size from 15px to 14px
- fix labels and buttons being cut off when their size is constrained
- change labels from monospace to sans-serif font
- move diff stats to right and change them from sum of changes to +/-
- change filemode to label and change text to match other labels

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-12 20:29:35 +08:00
Lunny Xiao
40b7c1755d
Merge branch 'main' into lunny/some_refactors 2026-01-10 18:25:14 -08:00
wxiaoguang
e226720cff
Refactor cat-file batch operations and support --batch-command approach (#35775)
Replace #34651 and address more problems including fix framework bugs and changing to QueryInfo and QueryContent calls.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2026-01-08 13:37:36 -08:00
Gregorius Bima Kharisma Wicaksana
f9d3983de2
fix: generate IDs for HTML headings without id attribute (#36233)
This PR fixes #27383 where HTML headings like `<h1>Title</h1>` in
markdown files would have empty permalink anchors

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-06 05:09:44 +00:00
Lunny Xiao
b34b0e5add Merge branch 'lunny/some_refactors' of github.com:lunny/gitea into lunny/some_refactors 2026-01-05 16:08:48 -08:00
Lunny Xiao
109e9e152e
update comment 2026-01-05 16:08:32 -08:00
Lunny Xiao
926228a66b
Merge branch 'main' into lunny/some_refactors 2026-01-05 15:54:15 -08:00
Daniel Mach
1d01286f4c
Add 'allow_maintainer_edit' API option for creating a pull request (#36283)
WebUI has a checkbox for enabling maintainer edits you can check right
away when creating a new pull request.
Also, it is possible to set `allow_maintainer_edit` in an existing pull
request via API.
This change enables the option while creating a new pull request via
API.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-06 01:00:26 +08:00
Joakim Olsson
1ee7f8e966
fix: prevent panic when GitLab release has more links than sources (#36295)
The code incorrectly assumed rel.Assets.Links and rel.Assets.Sources
arrays have equal length. This causes index out of bounds panic when
migrating GitLab releases with more links than sources, which is common
with GoReleaser-generated releases.

Fixes #36292

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-05 21:48:12 +08:00
Lauris BH
f2a69d828c
Merge branch 'main' into lunny/some_refactors 2026-01-04 16:59:10 +02:00
Lunny Xiao
af95cbc0de
Fix stats bug when syncing release (#36285) 2026-01-03 10:55:37 -08:00
wxiaoguang
b79dbfa990
Fix link/origin referrer and login redirect (#36279)
Fix #35998

1. Fix `<a rel>` :
    * "_blank" already means "noopener"
* "noreferrer" is already provided by page's `<meta name="referrer">`
2. Fix "redirect_to" mechisam
* Use "referer" header to determine the redirect link for a successful
login
3. Simplify code and merge duplicate logic
2026-01-03 11:43:04 +08:00
Lunny Xiao
f9d77d7501 Merge branch 'main' into lunny/some_refactors 2026-01-02 18:58:21 -08:00
Lunny Xiao
500fbe2c48
remove unused code 2026-01-02 18:55:32 -08:00
Lunny Xiao
68bb75168a
improvement 2026-01-02 18:50:54 -08:00
Lunny Xiao
8373f7deb3
improve the compare page (#36261)
- The compare page head title should be `compare` but not `new pull
request`.
- Use `UnstableGuessRefByShortName` instead of duplicated functions
calls.
- Direct-compare, tags, commits compare will not display `New Pull
Request` button any more.

The new screenshot
<img width="1459" height="391" alt="image"
src="https://github.com/user-attachments/assets/64e9b070-9c0b-41d1-b4b8-233b96270e1b"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-01-01 10:32:19 -08:00
Lunny Xiao
d3fb475186 Merge branch 'main' into lunny/some_refactors 2025-12-29 12:16:07 -08:00
Lunny Xiao
1771569300
Some refactor for repo path (#36251)
- Use `gitrepo.IsRepositoryExist` instead of `util.IsExit` or
`util.IsDir`
- Use `gitrepo.OpenRepository` instead of `git.OpenRepository`
- Use `gitrepo.DeleteRepository` instead of `util.RemoveAll`
- Use `gitrepo.RenameRepository` instead of `util.Rename`
2025-12-29 18:49:54 +00:00
Lunny Xiao
0ad94dfc70
Move catfile batch to a sub package of git module (#36232) 2025-12-29 10:19:42 -08:00
Lunny Xiao
73279fb770 Merge branch 'main' into lunny/some_refactors 2025-12-28 11:27:42 -08:00
Lunny Xiao
c7b3cdf7b1
Use gitrepo's push function (#36245)
extract from #36186
2025-12-28 13:24:28 +02:00
Gregorius Bima Kharisma Wicaksana
83527d3f8a
Support closing keywords with URL references (#36221)
## Summary

This PR adds support for closing keywords (`closes`, `fixes`, `reopens`,
etc.) with full URL references in markdown links.

**Before:**
- `closes #123`  works
- `closes org/repo#123`  works  
- `Closes [this issue](https://gitea.io/user/repo/issues/123)`  didn't
work
- `Fixes [#456](https://gitea.io/org/project/issues/456)`  didn't work

**After:**
All of the above now work correctly.

## Problem

When users reference issues using full URLs in markdown links (e.g.,
`Closes [this issue](https://gitea.io/user/repo/issues/123)`), the
closing keywords were not detected. This was because the URL processing
code explicitly stated:

```go
// Note: closing/reopening keywords not supported with URLs
```

Both methods of writing the reference render the same in the UI, so
users expected the closing keywords to behave the same.

## Solution

The fix works by:
1. Passing the original (unstripped) content to
`findAllIssueReferencesBytes`
2. When processing URL links from markdown, finding the URL position in
the original content
3. For markdown links `[text](url)`, finding the opening bracket `[`
position
4. Using that position to detect closing keywords before the link

## Testing

Added test cases for:
- `Closes [this issue](url)` - single URL with closing keyword
- `This fixes [#456](url)` - keyword in middle of text
- `Reopens [PR](url)` - reopen keyword with pull request URL
- Multiple URLs where only one has a closing keyword

All existing tests continue to pass.

Fixes #27549
2025-12-27 09:05:24 -08:00
Lunny Xiao
00cc84e37c
remove nolint (#36252) 2025-12-26 22:55:30 -08:00
Lunny Xiao
ff3d68b98a
Fix panic when get editor config file (#36241)
Fix #36239
2025-12-25 19:26:23 -08:00
Lunny Xiao
324dcf6f64
Use flatten translation keys (#36225)
Crowdin does not remove empty lines in nested JSON translation files.
Therefore, we use flattened translation keys instead. We have also
updated the key-loading logic to ensure that empty values are not
applied during translation.

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: TheFox0x7 <thefox0x7@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2025-12-25 12:51:33 -08:00
silverwind
42d294941c
Replace CSRF cookie with CrossOriginProtection (#36183)
Removes the CSRF cookie in favor of
[`CrossOriginProtection`](https://pkg.go.dev/net/http#CrossOriginProtection)
which relies purely on HTTP headers.

Fixes: https://github.com/go-gitea/gitea/issues/11188
Fixes: https://github.com/go-gitea/gitea/issues/30333
Helps: https://github.com/go-gitea/gitea/issues/35107

TODOs:

- [x] Fix tests
- [ ] Ideally add tests to validates the protection

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-12-25 12:33:34 +02:00
Lunny Xiao
10d4361a5c
Fix lint 2025-12-22 19:28:20 -08:00
Lunny Xiao
0394fca421 Merge branch 'main' into lunny/some_refactors 2025-12-22 19:03:41 -08:00
Lunny Xiao
b4df643ad1
Fix bug 2025-12-22 19:03:34 -08:00
Lunny Xiao
ffea9a27c3
Convert locale files from ini to json format (#35489)
Migrate from the current INI format to JSON for translations. JSON is
widely supported, including by platforms such as Crowdin and Weblate.
2025-12-19 09:50:48 -08:00
Lunny Xiao
e5fe09301a
Use new MergeBase method 2025-12-17 20:52:47 -08:00
Lunny Xiao
47f6f1dca9
Some refactors to reduce RepoPath 2025-12-17 20:29:01 -08:00
silverwind
1e22bd712f
Bump golangci-lint to 2.7.2, enable modernize stringsbuilder (#36180)
Fixes were done automatically by `make lint-go-fix`. These modernize
fixes are very readable.

Co-authored-by: Giteabot <teabot@gitea.io>
2025-12-17 20:50:53 +00:00
Lunny Xiao
ebf9b4dc6b
Use a migration test instead of a wrong test which populated the meta test repositories and fix a migration bug (#36160)
The test `TestGiteaUploadUpdateGitForPullRequest` modified the shared
meta test repositories directly, so this PR removes that test and
replaces it with an integration test that migrates a real repository
from gitea.com into a local test instance.

This PR also fixes a bug where pull-request migrations were not
correctly syncing head branches to the database.
2025-12-17 12:00:07 -08:00
silverwind
852bf5e2a5
Add git.DIFF_RENAME_SIMILARITY_THRESHOLD option (#36164)
Make the threshold value passed to `git diff --find-renames` configurable
2025-12-17 10:02:32 +00:00
Lunny Xiao
4c67aac23b
Move blame to gitrepo (#36161) 2025-12-16 16:14:14 -08:00
silverwind
84b74d7c3e
Enable bodyclose linter (#36168)
Enabe
[`bodyclose`](https://golangci-lint.run/docs/linters/configuration/#bodyclose).
The only issue in non-test code (`services/migrations/dump.go`) was a
false-positive and I think there are a number of undetected cases, but I
guess it's still better than not having it.

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-12-16 14:08:43 +01:00
Lunny Xiao
da087270ff
Some small refactors (#36163) 2025-12-15 11:55:44 -08:00
Lunny Xiao
26602fd207
Remove undocumented support of signing key in the repository git configuration file (#36143)
Per-repository signing keys have never been officially supported, as
they would require users to modify the repository’s config file.

At this point, it is clear that only global signing keys (GPG or SSH)
should be allowed. If we want to introduce per-repository signing keys
in the future, it will require a complete design proposal.

The endpoint will not be removed for repository special signing key, but
it will reference the global signing key.

---------

Signed-off-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2025-12-14 17:34:45 +00:00