Commit Graph

5130 Commits

Author SHA1 Message Date
silverwind
49a0a11f55 Update JS deps, misc tweaks (#35643)
- Update all JS dependencies
- Enable eslint `no-useless-assignment` and fix 2 discovered issues
- Replace `gitea-vscode` svg with new `octicon-vscode`
- Remove now-unused `@ts-expect-error` comments
- Change Monaco wrapping behaviour to match the wrapping in code view:
no wrapping indent and break on any character.
2025-10-12 21:07:15 +00:00
ChristopherHX
2401812b76 Cleanup ActionRun creation (#35624)
Closes #35622

---------

Signed-off-by: ChristopherHX <christopher.homberger@web.de>
Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-12 12:23:37 +00:00
鲁汀
b029ad431b Fix code tag style problem and LFS view bug (#35628)
Fix #35567

---------

Signed-off-by: 鲁汀 <131967983+lutinglt@users.noreply.github.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-12 02:38:42 +08:00
Zettat123
40f71bcd4c Support Actions concurrency syntax (#32751)
Fix #24769
Fix #32662
Fix #33260

Depends on https://gitea.com/gitea/act/pulls/124

-
https://docs.github.com/en/actions/writing-workflows/workflow-syntax-for-github-actions#concurrency

## ⚠️ BREAKING ⚠️

This PR removes the auto-cancellation feature added by #25716. Users
need to manually add `concurrency` to workflows to control concurrent
workflows or jobs.

---------

Signed-off-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-10 18:58:55 +00:00
Surya Purohit
b8e5e2a93e Fix diffpatch API endpoint (#35610)
Fix the swagger documentation for the `diffpatch` API endpoint,
and fix the wrong API path caused by a refactoring change.

Closes #35602

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-10 00:39:14 +08:00
Lunny Xiao
69f5ee970c Move some functions to gitrepo package (#35543)
Refactor Git command functions to use WithXXX methods instead of
exposing RunOpts.
This change simplifies reuse across gitrepo and improves consistency,
encapsulation, and maintainability of command options.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-07 17:06:51 +08:00
Rob Gonnella
c9e7fde8b3 feat: adds option to force update new branch in contents routes (#35592)
Allows users to specify a "force" option in API /contents routes when
modifying files in a new branch. When "force" is true, and the branch
already exists, a force push will occur provided the branch does not
have a branch protection rule that disables force pushing.

This is useful as a way to manage a branch remotely through only the
API. For example in an automated release tool you can pull commits,
analyze, and update a release PR branch all remotely without needing to
clone or perform any local git operations.

Resolve #35538

---------

Co-authored-by: Rob Gonnella <rob.gonnella@papayapay.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-06 21:23:14 -07:00
Lunny Xiao
ad2ff67343 Move archive function to repo_model and gitrepo (#35514) 2025-10-06 15:01:26 -07:00
Shafi Ahmed
0a0baeb3b0 fix: auto-expand and auto-scroll for actions logs (#35570) (#35583)
Implements reliable auto-expand and auto-scroll behavior for the Actions
logs view.

* Expands running or unfinished steps automatically.
* Smoothly scrolls to the latest log line during execution.
* Controlled via existing “Always auto-scroll” and “Expand running
steps” options.

Fixes #35570.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-05 10:31:06 +08:00
Lunny Xiao
17c8aa6587 Add rebase push display wrong comments bug (#35560)
Fix #35518

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-10-03 15:16:17 -07:00
wxiaoguang
71360a94cb Address some CodeQL security concerns (#35572)
Although there is no real security problem
2025-10-04 01:21:26 +08:00
Steven Noonan
c5332fdc55 add more routes to the "expensive" list (#35547)
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
2025-09-29 17:33:28 +08:00
6543
fbe80e6df2 Add proper error message if session provider can not be created (#35520)
the middleware that creates the session provider just panics if on
creation the config is wrong.
this is not catched and so you just get an cryptic stacktrace with no
point where to look at (as user).

## Before

```
2025/09/16 03:56:37 ...xer/stats/indexer.go:87:populateRepoIndexer() [I] Done (re)populating the repo stats indexer with existing repositories
2025/09/16 03:56:37 modules/ssh/ssh.go:387:Listen() [I] Adding SSH host key: /var/lib/gitea/data/ssh/gitea.rsa
2025/09/16 03:56:37 modules/ssh/init.go:26:Init() [I] SSH server started on :1234. Cipher list ([chacha20-poly1305@openssh.com aes128-ctr aes192-ctr aes256-ctr aes128-gcm@openssh.com aes256-gcm@openssh.com]), key exchange algorithms ([curve25519-sha256 ecdh-sha2-nistp256 ecdh-sha2-nistp384 ecdh-sha2-nistp521 diffie-hellman-group14-sha256 diffie-hellman-group14-sha1]), MACs ([hmac-sha2-256-etm@openssh.com hmac-sha2-256 hmac-sha1])
2025/09/16 03:56:37 ...s/graceful/server.go:50:NewServer() [I] Starting new SSH server: tcp::1234 on PID: 83337
2025/09/16 03:56:38 cmd/web.go:231:func1() [F] PANIC: dial tcp 127.0.0.1:6379: connect: connection refused
gitea.com/go-chi/session@v0.0.0-20240316035857-16768d98ec96/session.go:239 (0x1cdb908)
code.gitea.io/gitea/routers/common/middleware.go:108 (0x2547f5a)
code.gitea.io/gitea/routers/web/web.go:270 (0x278b8e9)
code.gitea.io/gitea/routers/init.go:185 (0x2850d89)
code.gitea.io/gitea/cmd/web.go:211 (0x295c5ad)
code.gitea.io/gitea/cmd/web.go:262 (0x295cacb)
code.gitea.io/gitea/cmd/main.go:111 (0x2953422)
github.com/urfave/cli/v2@v2.27.2/command.go:276 (0x1cc3dfd)
github.com/urfave/cli/v2@v2.27.2/command.go:269 (0x1cc4084)
github.com/urfave/cli/v2@v2.27.2/app.go:333 (0x1cc086a)
github.com/urfave/cli/v2@v2.27.2/app.go:307 (0x2953f18)
code.gitea.io/gitea/cmd/main.go:172 (0x2953efc)
code.gitea.io/gitea/main.go:46 (0x2998498)
runtime/proc.go:283 (0x4471ca)
runtime/asm_amd64.s:1700 (0x484a20)
```

## After

```
2025/09/22 22:52:35 .../templates/htmlrenderer.go:118:initHTMLRenderer() [D] Creating static HTML Renderer
2025/09/22 22:52:35 routers/web/web.go:273:Routes() [F] common.Sessioner failed: failed to create session middleware: dial tcp 127.0.0.1:6379: connect: connection refused
```

---------

Signed-off-by: 6543 <6543@obermui.de>
2025-09-28 12:24:19 +00:00
Lunny Xiao
8106d95577 Use global lock instead of status pool for cron lock (#35507) 2025-09-27 10:11:52 -07:00
Lunny Xiao
1f32170060 Move some functions to gitrepo package (#35503) 2025-09-26 10:14:20 -07:00
Lunny Xiao
7bf2972379 Move GetDiverging functions to gitrepo (#35524)
Extracted from #35469

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-26 15:15:42 +00:00
Fabien Benetou
53dfbbb2ee Update issue.go with labels documentation (labels content, not ids) (#35522)
For https://github.com/go-gitea/gitea/issues/35521

---------

Signed-off-by: Fabien Benetou <fabien-services@benetou.fr>
2025-09-25 16:56:49 +00:00
wxiaoguang
d83676c97a Fix markup init after issue comment editing (#35536)
Fix #35533
2025-09-25 09:29:32 -07:00
Lunny Xiao
198f37e33c Move updateref and removeref to gitrepo and remove unnecessary open repository (#35511)
Extracted from #35077
`UpdateRef` and `RemoveRef` will call git commands even for gogit
version.
2025-09-19 08:04:18 -07:00
ChristopherHX
9a0ec53ee3 Stream repo zip/tar.gz/bundle achives by default (#35487)
Initial implementation of linked proposal.

* Closes #29942
* Fix #34003
* Fix #30443

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-19 11:51:21 +08:00
Lunny Xiao
9332ff291b Move git command to git/gitcmd (#35483)
The name cmd is already used in many places and may cause conflicts, so
I chose `gitcmd` instead to minimize potential naming conflicts.
2025-09-15 23:33:12 -07:00
wxiaoguang
4fe1066a17 Replace gobwas/glob package (#35478)
https://github.com/gobwas/glob is unmaintained and has bugs.
2025-09-13 18:01:00 +00:00
luzpaz
688abac5ca Fix various typos in codebase (#35480) 2025-09-13 10:34:43 -04:00
ChristopherHX
84812e42df Fix SSH signing key path will be displayed in the pull request UI (#35381)
Closes #35361

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-12 03:00:18 +00:00
Lunny Xiao
89d7929711 Fix package link setting can only list limited repositories (#35394)
Fix #24801

<img width="1123" height="503" alt="image"
src="https://github.com/user-attachments/assets/823f4214-e08a-4506-9018-057c50e7fc52"
/>

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: Giteabot <teabot@gitea.io>
2025-09-11 01:50:17 +02:00
Lunny Xiao
274f4aea7e Fix a compare page 404 bug when the pull request disabled (#35441) 2025-09-09 21:04:32 -07:00
koalajoe23
2802f96e97 check user and repo for redirects when using git via SSH transport (#35416)
fixes #30565 

When using git with a gitea hosted repository, the HTTP-Transport did
honor the user and repository redirects, which are created when renaming
a user or repo and also when transferring ownership of a repo to a
different organization. This is extremely helpful, as repo URLs remain
stable and do not have to be migrated on each client's worktree and
other places, e.g. CI at once.

The SSH transport - which I favor - did not know of these redirections
and I implemented a lookup during the `serv` command.
2025-09-09 20:13:41 +00:00
Lunny Xiao
e4cb48a7e0 Fix bug when issue disabled, pull request number in the commit message cannot be redirected (#35420)
Fix #35419

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-09 12:14:06 -07:00
Akhan Zhakiyanov
87362b4dc1 fix: add author.name field to Swift Package Registry API response (#35410)
Fixes #35159

Swift Package Manager expects an 'author.name' field in package
metadata, but Gitea was only providing schema.org format fields
(givenName, middleName, familyName). This caused SPM to fail with
keyNotFound error when fetching package metadata.

Changes:
- Add 'name' field to Person struct (inherited from
https://schema.org/Thing)
- Populate 'name' field in API response using existing String() method
- Maintains backward compatibility with existing schema.org fields
- Provides both formats for maximum compatibility

The fix ensures Swift Package Manager can successfully resolve packages
while preserving full schema.org compliance.
2025-09-07 18:24:25 +00:00
Lunny Xiao
3e3c36bc30 split admin config settings templates to make it maintain easier (#35294) 2025-09-04 15:42:26 +00:00
Lunny Xiao
d2e994db2c Move git config/remote to gitrepo package and add global lock to resolve possible conflict when updating repository git config file (#35151)
Partially fix #32018 

`git config` and `git remote` write operations create a temporary file
named `config.lock`. Since these operations are not atomic, they must
not be run in parallel. If two requests attempt to modify the same
repository concurrently—such as during a compare operation—one may fail
due to the presence of an existing `config.lock` file.

In cases where `config.lock` is left behind due to an unexpected program
exit, a global lock mechanism could allow us to safely remove the stale
lock file when a related error is detected. While this behavior is not
yet implemented in this PR, it is planned for a future enhancement.

---------

Signed-off-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-09-01 18:47:04 +00:00
Lunny Xiao
4e1b8db1fc Move HasWiki to repository service package (#33912)
Move HasWiki out of the models package to avoid referencing the absolute
wiki path directly.
2025-09-01 11:12:58 -07:00
Michal Suchánek
ea96ff6b0c Rename UpdateBranch API to RenameBranch API (#35374)
Discussed in #35368, originally implemented in #32433
2025-09-01 16:12:05 +00:00
Lunny Xiao
aef4a3514c Remove the duplicated function GetTags (#35375)
This PR removes the GetTags function from the git module and keeps only
GetTagInfos. All previous usages of GetTags have been replaced with
database-based tag functions.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2025-08-29 01:11:42 +00:00
Lunny Xiao
fb056bf4ed Use gitrepo.SetDefaultBranch when set default branch of wiki repository (#33911) 2025-08-28 06:06:39 +00:00
wxiaoguang
0cbaa0b662 Remove incorrect "db.DefaultContext" usages (#35366) 2025-08-28 03:52:43 +00:00
wxiaoguang
60246730b5 Remove wrong "git.DefaultContext" (#35364) 2025-08-27 16:31:21 +00:00
wxiaoguang
e837c998b7 Fix context usages (#35348) 2025-08-27 11:00:01 +00:00
Lunny Xiao
c4fbccc4ec Allow deleting comment with content via API like web did (#35346)
Fix #35296
2025-08-25 10:43:11 +00:00
NorthRealm
c7b99c8cc7 Prevent duplicate actions email (#35215)
Trying to prevent duplicate action emails by adding an extra check on job status.

---------

Signed-off-by: NorthRealm <155140859+NorthRealm@users.noreply.github.com>
Co-authored-by: Christopher Homberger <christopher.homberger@web.de>
2025-08-24 09:30:56 -07:00
Lunny Xiao
3a969a58c2 Fix atom/rss mixed error (#35345) 2025-08-23 22:29:52 +00:00
techknowlogick
a2d88cd597 Remove deprecated auth sources (#35272)
Entra ID users should use the OIDC oauth2 provider.

They will still be shown if the instance has a previous Azure AD source
configured.

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
2025-08-23 20:39:05 +00:00
Lunny Xiao
e1fd9e3cd1 Always return the relevant status information, even if no status exists. (#35335) 2025-08-23 18:48:44 +00:00
Ilya Nurullin
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
Lunny Xiao
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
6543
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
NorthRealm
becd15f743 Fix Actions API (#35204)
Fixed a nil pointer error.

Related #34337
2025-08-04 23:41:30 -04:00
6543
de570b7dde Remove unneeded if statements for update repo API (#35140)
just try to make the update func more redable and be more KISS

---
_Sponsored by Kithara Software GmbH_
2025-08-05 01:38:35 +00:00
Nicolas Auvray
c760e3b2b5 Display pull request in merged commit view (#35202)
Fixes #34634

---

I am not a Web dev so I'm open to any change on the design. The
important thing for me is to have the feature implemented.

Here are screenshots on a test instance:

<img width="2758" height="420" alt="Capture d'écran 2025-08-02 161710"
src="https://github.com/user-attachments/assets/30abbeb5-6139-4a91-9348-36e78f1646e6"
/>

<img width="2769" height="520" alt="Capture d'écran 2025-08-02 161725"
src="https://github.com/user-attachments/assets/29871f05-f0b5-4a31-9ada-812780269c7d"
/>
2025-08-04 23:30:12 +00:00
Lunny Xiao
be2a6b4414 Fix bug when review pull request commits (#35192)
The commit range in the UI follows a half-open, half-closed convention:
(,]. When reviewing a range of commits, the beforeCommitID should be set
to the commit immediately preceding the first selected commit. For
single-commit reviews, we must identify and use the previous commit of
that specific commit.

The endpoint ViewPullFilesStartingFromCommit is currently unused and can
be safely removed.

Fix #35157 
Replace #35184 
Partially extract from #35077
2025-08-03 10:23:10 -07:00