4925 Commits

Author SHA1 Message Date
e844a41248 Use configurable remote name for git commands (#35172)
Closes #19403, and makes it possible to use any remote name in code
snippets for an empty repository and pull request.
This change is very helpful to me, because I always use different name
for my gitea remote.

Uses setting config module to store the value. Default is `origin` for
backward compatibility.

### Screenshots
<details>
<summary>Empty repo</summary>
<img width="791" height="398" alt="image"
src="https://github.com/user-attachments/assets/7214053d-a8dd-4e77-8c9d-78936d9859e0"
/>
</details>

<details>
<summary>Pull Request</summary>
<img width="591" height="452" alt="image"
src="https://github.com/user-attachments/assets/ebc3d25c-5d6d-481d-819d-9706af3c5594"
/>
</details>

<details>
<summary>Settings page</summary>
<img width="1438" height="839" alt="image"
src="https://github.com/user-attachments/assets/d92bfa2c-7adc-4efe-95fa-0c55ad13b3f5"
/>
</details>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-21 10:14:35 -07:00
c0f24bd803 Move organization's visibility change to danger zone. (#34814)
<img width="1185" alt="image"
src="https://github.com/user-attachments/assets/d48c4db2-df7c-43b3-986c-62e042190a51"
/>

<img width="829" alt="image"
src="https://github.com/user-attachments/assets/772b8a14-6837-41f2-9d78-9f0489ef1c7d"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-20 20:57:42 -07:00
709535c506 Fix some overflows in test (#35315)
Fix #35311
2025-08-20 15:20:22 +00:00
d782cad7f8 Add start time on perf trace because it seems some steps haven't been recorded. (#35282)
The new trace log looks like
```
http start=2025-08-14 15:03:04 duration=0.6978s http.route=/
  http.func start=2025-08-14 15:03:04 duration=0.6978s func=common.ForwardedHeadersHandler.ForwardedHeaders
    http.func start=2025-08-14 15:03:04 duration=0.6978s func=routing.(*requestRecordsManager).handler-fm
      http.func start=2025-08-14 15:03:04 duration=0.6978s func=gzhttp.NewWrapper
        http.func start=2025-08-14 15:03:04 duration=0.6975s func=session.Sessioner
          http.func start=2025-08-14 15:03:04 duration=0.6973s func=context.Contexter
```
2025-08-18 15:17:19 +00:00
90a48e96c7 Fix a bug where lfs gc never worked. (#35198)
Fix #31113

After #22385 introduced LFS GC, it never worked due to a bug in the INI
library: fields in structs embedded more than one level deep are not
populated from the INI file.

This PR fixes the issue by replacing the multi-level embedded struct
with a single-level struct for parsing the cron.gc_lfs configuration.

Added a new test for retrieving cron settings to demonstrate the bug in
the INI package.
2025-08-12 05:38:17 +00:00
345045888d modules/setting/actions.go: fixed typo: ì->i (#35253) 2025-08-11 22:57:44 -04:00
9b5a3e9c9c Update chroma to v2.20.0 (#35220)
https://github.com/alecthomas/chroma/releases/tag/v2.20.0

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-11 13:00:20 +02:00
ef613ee760 Add has_code to repository REST API (#35214)
similar to how we can enable/disable repos or issues on a repo add the
code unit as option to it.

affects

```
PATCH /repos/{owner}/{repo}
```

---
*Sponsored by Kithara Software GmbH*
2025-08-08 18:18:30 +02:00
c3f5ea3b1f Fix repo file list partial reloading for submodules (#35183)
Fix the TODO and add more tests
2025-07-31 09:34:51 +08:00
85b5877bb0 Fix various bugs (#35177)
* Fix #35144
* Fix #35117
* Fix https://github.com/go-gitea/gitea/issues/35054#issuecomment-3131793977
* Fix #35136
2025-07-30 07:08:59 +00:00
c10c4203ee Add owner and parent fields clarification to docs (#35023)
Issue: https://github.com/go-gitea/gitea/issues/9637

Changes introduced: I have clarified the problematic terms (owner and
parent) in all affected endpoints.

The changes were made to relevant:

- HTTP endpoint parameters' descriptions
- response/request models' fields

This MR is big, but most changes are the same. If you'd like me to break
this MR into several smaller ones, let me know :)

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-23 06:44:34 +00:00
86aafea3fb Fix session gob (#35128)
Fix #35126
2025-07-20 01:49:36 +00:00
c4f5b2b531 Don't use full-file highlight when there is a git diff textconv (#35114)
Fix #35106
2025-07-18 19:16:27 +08:00
8f91bfe9d8 Fix submodule parsing when the gitmodules is missing (#35109)
Follow up #35096, fix #35095, fix #35115 and add more tests

The old code used some fragile behaviors which depend on the "nil"
receiver. This PR should be a complete fix for more edge cases.
2025-07-18 09:42:44 +00:00
8ee96039aa Fix some missed GitHeadRefName when renaming (#35102) 2025-07-17 14:01:11 +00:00
de1114b4e8 Fix error logs and improve some comments/messages (#35105) 2025-07-17 19:09:54 +08:00
37958e486a Rename pull request GetGitRefName to GetGitHeadRefName (#35093) 2025-07-16 21:33:33 +08:00
fc4cb07beb Fix submodule nil check (#35096)
Fix  #35095
2025-07-16 12:07:38 +00:00
e1e4815a1c Redirect to a presigned URL of HEAD for HEAD requests (#35088)
Resolves https://github.com/go-gitea/gitea/issues/35086.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-16 11:22:45 +00:00
d08459820d Improve submodule relative path handling (#35056)
Fix #35054

---------

Co-authored-by: Giteabot <teabot@gitea.io>
2025-07-14 23:28:34 +08:00
1352080ef7 Fix incorrect comment diff hunk parsing, fix github asset ID nil panic (#35046)
* Fix missing the first char when parsing diff hunk header
* Fix #35040
* Fix #35049

----

Introduced in
https://github.com/go-gitea/gitea/pull/12047/files#diff-de48c2f70e24ff5603180acf8b5ce9d0356ede8a45bfbf2a485707282ace6d6aR268

Before:

<img width="487" height="167" alt="image"
src="https://github.com/user-attachments/assets/17524c76-a296-4b4b-a4f9-c5150c41bae5"
/>

After:

<img width="749" height="144" alt="image"
src="https://github.com/user-attachments/assets/bcb12c76-c1ae-40f1-81b7-183d15f891db"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-11 15:18:41 -07:00
b46623f6a5 Fix updating user visibility (#35036)
Fix #35030

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-10 16:17:28 -07:00
7a15334656 Fix git commit committer parsing and add some tests (#35007)
* Fix #34991
* Fix #34882

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-10 19:03:36 +00:00
a5a3d9b101 Refactor OpenIDConnect to support SSH/FullName sync (#34978)
* Fix #26585
* Fix #28327
* Fix #34932
2025-07-10 18:35:59 +00:00
f35dcfd489 Make submodule link work with relative path (#35034)
Fix #35033
2025-07-10 16:38:42 +00:00
af0196c145 Fix ListWorkflowRuns OpenAPI response model. (#35026)
Change the OpenAPI response of `ListWorkflowRuns` to `WorkflowRunsList`
like it is supposed to be.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-10 05:58:07 +00:00
211135b4bb Fix various problems (#35012)
* Fix #35011
* Fix incorrect log message for "Protocol"
* Remove unnecessary styles, fix "comment-header" wrap, fix label height
2025-07-09 16:46:51 +00:00
55f350542c Refactor mail template and support preview (#34990) 2025-07-09 10:25:25 +08:00
f88800d545 Improve NuGet API Parity (#21291) (#34940)
Fixes #21291, allowing icons and other missing attributes to appear for
NuGet packages from inside Visual Studio like they do with GitHub Nuget
packages.

Adds additional NuGet package information, particularly `IconURL`, to
bring the Gitea NuGet API more in-line with GitHub's NuGet API.

ref: https://learn.microsoft.com/en-us/nuget/api/search-query-service-resource
2025-07-07 10:43:58 +00:00
95a935aca0 Enable gocritic equalFold and fix issues (#34952)
Continuation of https://github.com/go-gitea/gitea/pull/34678.

---------

Signed-off-by: silverwind <me@silverwind.io>
2025-07-06 16:53:34 +00:00
3533263ced Improve OAuth2 provider (correct Issuer, respect ENABLED) (#34966)
1. Make "Issuer" strictly follow the spec (see comment)
2. Make "/.well-known/openid-configuration" respond 404 if the OAuth2
provider is not enabled.

Then by the way, remove the JSEscape template helper because it is not
needed any more.
2025-07-06 13:36:45 +08:00
6033c67a1a Refactor some trivial problems (#34959)
1. make our "route group pattern match" also update chi's RoutePattern
2. fix incorrect "NotFound" call in conda package
3. make ".flex-item .flex-item-main" has a general gap, then no need to
use `tw` tricks
4. improve the "test webhook" UI
2025-07-05 23:19:33 +08:00
d6d643fe86 Fix http auth header parsing (#34936)
Using `strings.EqualFold` is wrong in many cases.
2025-07-03 03:02:38 +00:00
6455c8202b Support getting last commit message using contents-ext API (#34904)
Fix #34870
Fix #34929

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-07-03 09:45:42 +08:00
8dbf13b1cb Follow file symlinks in the UI to their target (#28835)
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>
2025-07-01 06:55:36 +08:00
176962c03e Add support for 3D/CAD file formats preview (#34794)
Fix #34775 

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-30 16:12:25 +08:00
f74a13610d Add a login/login-name/username disambiguation to affected endpoint parameters and response/request models (#34901)
Issue: [link](https://github.com/go-gitea/gitea/issues/9637)

Changes introduced: I have clarified the problematic terms (`login`,
`login_name`, and `username`) in all affected endpoints.

The changes were made to relevant:
- HTTP endpoint parameters' descriptions 
- response/request models' fields
2025-06-29 21:17:45 -07:00
1e50cec0b3 Improve labels-list rendering (#34846)
Make labels list use consistent gap

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-27 23:12:25 +08:00
aa9d86745a enforce explanation for necessary nolints and fix bugs (#34883)
Follows up https://github.com/go-gitea/gitea/pull/34851

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-27 21:48:03 +08:00
eb36a4554e enforce nolint scope (#34851)
enable nolintlint scope requirement
add comments to new directives so it's more obvious why they are in
place

---

I can also toggle the mandatory comments on if that's something of
interest.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-06-27 07:59:55 +02:00
0771a79bf0 Use standalone function to update repository cols (#34811)
Extract `UpdateRepository`
Follow up #34762

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-06-26 17:23:21 +00:00
c67a8397ff Add issue delete notifier (#34592)
Fixes https://github.com/go-gitea/gitea/issues/34591

A reference regarding the deletion of issue webhooks on GitHub:
https://docs.github.com/en/webhooks/webhook-events-and-payloads?actionType=deleted#issues
2025-06-25 18:53:02 +00:00
75aa23a665 Refactor "change file" API (#34855)
Follow up the "editor" refactor, use the same approach to simplify code,
and fix some docs & comments

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
2025-06-25 11:25:20 -07:00
dbd9c69909 Refactor repo contents API and add "contents-ext" API (#34822)
See the updated swagger document for details.
2025-06-25 02:34:21 +00:00
22a84a72cd Fix SSH LFS timeout (#34838)
Fix #34834
2025-06-24 15:49:31 +00:00
327048c106 Refactor template helper (#34819)
FIx abuses and remove unused code

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
2025-06-24 01:27:35 +08:00
1748045285 Refactor packages (#34777) 2025-06-22 19:22:51 +08:00
f114c388ff Refactor wiki (#34805)
Remove unclear code
2025-06-22 18:53:33 +08:00
4fc626daa1 Refactor editor (#34780)
A complete rewrite
2025-06-21 19:20:51 +08:00
81adb01713 Improve img lazy loading (#34804)
Related #32051 and #13526
2025-06-21 14:53:22 +08:00