]> source.dussan.org Git - gitea.git/log
gitea.git
8 months agoFix orgmode link resolving (#29024)
wxiaoguang [Wed, 7 Feb 2024 08:32:31 +0000 (16:32 +0800)]
Fix orgmode link resolving (#29024)

Fix #28974

Add some new tests and fix some legacy unclear tests.

8 months agoRemove lightningcss (#29070)
silverwind [Wed, 7 Feb 2024 02:17:59 +0000 (03:17 +0100)]
Remove lightningcss (#29070)

Remove lightningcss and minify with esbuild again. The size of output
CSS will increase by around 1.4%, but I think it's worth it to allow
building gitea in more cases like the one in the linked issue. We can
reconsider once lightningcss becomes more stable.

Fixes: https://github.com/go-gitea/gitea/issues/29058
8 months agoHide code links on release page if user cannot read code (#29064)
Jason Song [Tue, 6 Feb 2024 11:57:25 +0000 (19:57 +0800)]
Hide code links on release page if user cannot read code (#29064)

On the release list page, if the user doesn't have the permission to
read code, the code links will lead to 404 pages or api errors:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a74fbc63-6dd6-43c6-853c-28acdbfdcb4e">

After this PR:

<img width="1297" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/a626373d-c2df-40a9-8fed-1b12ff6bc56f">

And this PR also removed some dead code. After #23465, the tag list page
has an independent template, and all `IsTag` in the release list
template are always false.

8 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Tue, 6 Feb 2024 00:23:28 +0000 (00:23 +0000)]
[skip ci] Updated translations via Crowdin

8 months agoDon't do a full page load when clicking `Watch` or `Star` (#29001)
Yarden Shoham [Mon, 5 Feb 2024 09:56:20 +0000 (11:56 +0200)]
Don't do a full page load when clicking `Watch` or `Star` (#29001)

- The watch/unwatch button and star/unstar get their own template
- The backend returns HTML instead of redirect

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: John Olheiser <john.olheiser@gmail.com>
8 months agoRemove useless template file (#29053)
Jason Song [Mon, 5 Feb 2024 09:23:08 +0000 (17:23 +0800)]
Remove useless template file (#29053)

Removed `templates/repo/settings/nav.tmpl`.

I don't think it's still used.

On main branch:
<img width="521" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/c0bf958c-698a-4348-840e-3ade0312bd6e">

On commit 755eec745fa324fdd13078f0147638f8731652ba (the commit that
created this file):

<img width="615" alt="image"
src="https://github.com/go-gitea/gitea/assets/9418365/5156b26d-1ecd-4197-a0a6-dc2d17652ff4">

8 months agoFix typos in the documentation (#29048)
Wang [Mon, 5 Feb 2024 08:19:05 +0000 (16:19 +0800)]
Fix typos in the documentation (#29048)

Corrected two typos.

8 months agoMove some repository transfer functions to service layer (#28855)
Lunny Xiao [Mon, 5 Feb 2024 06:17:23 +0000 (14:17 +0800)]
Move some repository transfer functions to service layer (#28855)

8 months agoPropagate install_if and provider_priority to APKINDEX (#28899)
Sergey Bugaev [Mon, 5 Feb 2024 05:52:56 +0000 (08:52 +0300)]
Propagate install_if and provider_priority to APKINDEX (#28899)

Resolves https://github.com/go-gitea/gitea/issues/28704

Example of an entry in the generated `APKINDEX` file:

```
C:Q1xCO3H9LTTEbhKt9G1alSC87I56c=
P:hello
V:2.12-r1
A:x86_64
T:The GNU Hello program produces a familiar, friendly greeting
U:https://www.gnu.org/software/hello/
L:GPL-3.0-or-later
S:15403
I:36864
o:hello
m:
t:1705934118
D:so:libc.musl-x86_64.so.1
p:cmd:hello=2.12-r1
i:foobar=1.0 !baz
k:42
```

the `i:` and `k:` entries are new.

---------

Co-authored-by: KN4CK3R <admin@oldschoolhack.me>
8 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 5 Feb 2024 00:25:25 +0000 (00:25 +0000)]
[skip ci] Updated licenses and gitignores

8 months agoShow whether a PR is WIP inside popups (#28975)
Bram Hagens [Sun, 4 Feb 2024 22:37:45 +0000 (23:37 +0100)]
Show whether a PR is WIP inside popups  (#28975)

Fixes https://codeberg.org/forgejo/forgejo/issues/2257

Draft status of a PR is currently not exposed by the API. This PR adds a
'draft' field to pull requests in the API, which is used to correctly
set the PR color/icon in a ContextPopup.

---

Before:

![image](https://github.com/go-gitea/gitea/assets/5541521/72cbd30e-1175-4338-aa97-ac99c46c5118)

After:

![image](https://github.com/go-gitea/gitea/assets/5541521/111c9eba-460e-4d57-bcca-23a151c3a4f1)

8 months agoUnify password changing and invalidate auth tokens (#27625)
KN4CK3R [Sun, 4 Feb 2024 14:05:26 +0000 (15:05 +0100)]
Unify password changing and invalidate auth tokens (#27625)

- Unify the password changing code
- Invalidate existing auth tokens when changing passwords

8 months agoUnify user update methods (#28733)
KN4CK3R [Sun, 4 Feb 2024 13:29:09 +0000 (14:29 +0100)]
Unify user update methods (#28733)

Fixes #28660
Fixes an admin api bug related to `user.LoginSource`
Fixed `/user/emails` response not identical to GitHub api

This PR unifies the user update methods. The goal is to keep the logic
only at one place (having audit logs in mind). For example, do the
password checks only in one method not everywhere a password is updated.

After that PR is merged, the user creation should be next.

8 months agoDo not render empty comments (#29039)
wxiaoguang [Sun, 4 Feb 2024 13:05:01 +0000 (21:05 +0800)]
Do not render empty comments (#29039)

Follow #28654

The `comments` might be empty, so the templates shouldn't (and couldn't)
use it to render. When there is no comment, the UI should also be
updated to empty, so returning an empty body is good enough.

8 months agoAdd `must-change-password` cli parameter (#27626)
KN4CK3R [Sat, 3 Feb 2024 17:53:27 +0000 (18:53 +0100)]
Add `must-change-password` cli parameter (#27626)

This PR adds a new `must-change-password` parameter to the
`change-password` cli command.
We already have the `must-change-password` command but it feels natural
to have this integrated into the `change-password` cli command.

---------

Co-authored-by: 6543 <6543@obermui.de>
8 months agoInclude username in email headers (#28981)
Gwyneth Morgan [Sat, 3 Feb 2024 00:41:27 +0000 (00:41 +0000)]
Include username in email headers (#28981)

Emails from Gitea comments do not contain the username of the commenter
anywhere, only their display name, so it is not possible to verify who
made a comment from the email itself:

From: "Alice" <email@gitea>
X-Gitea-Sender: Alice
X-Gitea-Recipient: Bob
X-GitHub-Sender: Alice
X-GitHub-Recipient: Bob

This comment looks like it's from @alice.

The X-Gitea/X-GitHub headers also use display names, which is not very
reliable for filtering, and inconsistent with GitHub's behavior:

X-GitHub-Sender: lunny
X-GitHub-Recipient: gwymor

This change includes both the display name and username in the From
header, and switches the other headers from display name to username:

From: "Alice (@fakealice)" <email@gitea>
X-Gitea-Sender: fakealice
X-Gitea-Recipient: bob
X-GitHub-Sender: fakealice
X-GitHub-Recipient: bob

This comment looks like it's from @alice.

8 months agoUpdate tool dependencies (#29030)
silverwind [Sat, 3 Feb 2024 00:11:39 +0000 (01:11 +0100)]
Update tool dependencies (#29030)

8 months agoAdd artifacts v4 jwt to job message and accept it (#28885)
ChristopherHX [Fri, 2 Feb 2024 14:25:59 +0000 (15:25 +0100)]
Add artifacts v4 jwt to job message and accept it (#28885)

This change allows act_runner / actions_runner to use jwt tokens for
`ACTIONS_RUNTIME_TOKEN` that are compatible with
actions/upload-artifact@v4.

The official Artifact actions are now validating and extracting the jwt
claim scp to get the runid and jobid, the old artifact backend also
needs to accept the same token jwt.

---
Related to #28853

I'm not familar with the auth system, maybe you know how to improve this

I have tested
- the jwt token is a valid token for artifact uploading
- the jwt token can be parsed by actions/upload-artifact@v4 and passes
their scp claim validation

Next steps would be a new artifacts@v4 backend.

~~I'm linking the act_runner change soonish.~~
act_runner change to make the change effective and use jwt tokens
<https://gitea.com/gitea/act_runner/pulls/471>

8 months agoPass es2020 to esbuild-loader as well (#29027)
silverwind [Fri, 2 Feb 2024 14:01:32 +0000 (15:01 +0100)]
Pass es2020 to esbuild-loader as well (#29027)

Followup https://github.com/go-gitea/gitea/pull/28977. I forgot to pass
the updated option to esbuild-loader, e.g. previously it was only passed
to the minifier.

8 months agoFix default avatar image size in PR diff page (#28971)
yp05327 [Fri, 2 Feb 2024 10:01:11 +0000 (19:01 +0900)]
Fix default avatar image size in PR diff page (#28971)

Fix #28941

ps: didn't test. The repo is too big to migrate.

8 months agoUpdate JS and PY dependencies, build for `es2020` browsers (#28977)
silverwind [Fri, 2 Feb 2024 09:36:32 +0000 (10:36 +0100)]
Update JS and PY dependencies, build for `es2020` browsers (#28977)

- Update all JS dependencies minus @mcaptcha/vanilla-glue
- Fix new lint errors
- Regenerate SVGs
- Switch to maintained stylelint stylistic plugin
- Tested Mermaid, Citation, Swagger, sorting
- Raise ESBuild target to `es2020` as dictated by `pretty-ms`
dependency.

8 months agoWrap contained tags and branches again (#29021)
delvh [Fri, 2 Feb 2024 04:51:09 +0000 (05:51 +0100)]
Wrap contained tags and branches again (#29021)

Fixes #29016

## After

![grafik](https://github.com/go-gitea/gitea/assets/51889757/2c72ee8f-439e-4328-85df-77772e0f4aef)

8 months agoAvoid sending update/delete release notice when it is draft (#29008)
yp05327 [Fri, 2 Feb 2024 04:18:12 +0000 (13:18 +0900)]
Avoid sending update/delete release notice when it is draft (#29008)

Fix #27157

8 months agoFix incorrect button CSS usages (#29015)
wxiaoguang [Thu, 1 Feb 2024 21:28:50 +0000 (05:28 +0800)]
Fix incorrect button CSS usages (#29015)

8 months agoStrip trailing newline in markdown code copy (#29019)
silverwind [Thu, 1 Feb 2024 21:01:48 +0000 (22:01 +0100)]
Strip trailing newline in markdown code copy (#29019)

Behaviour now matches GH. Safeguard added in the for loop because
`textContent` may be null in which case it does not make sense to render
the copy button.

8 months agoImprove user search display name (#29002)
KN4CK3R [Thu, 1 Feb 2024 17:10:16 +0000 (18:10 +0100)]
Improve user search display name (#29002)

I tripped over this strange method and I don't think we need that
workaround to fix the value.

old:

![grafik](https://github.com/go-gitea/gitea/assets/1666336/c8b6797b-eb45-4dec-99db-1b0649a34ec5)

new:

![grafik](https://github.com/go-gitea/gitea/assets/1666336/ab1a65ae-de5b-4ce4-9813-3b8b39c7922e)

---------

Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
8 months agoRevert "Speed up loading the dashboard on mysql/mariadb (#28546)" (#29006)
Lunny Xiao [Thu, 1 Feb 2024 06:25:37 +0000 (14:25 +0800)]
Revert "Speed up loading the dashboard on mysql/mariadb (#28546)" (#29006)

This reverts commit fa8c3beb26acfcc7e732038c947225857ebcbf31. #28546
Because it seems performance become worse.

8 months agoUpdate dorny/paths-filter action (#29003)
silverwind [Thu, 1 Feb 2024 01:43:06 +0000 (02:43 +0100)]
Update dorny/paths-filter action (#29003)

8 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 1 Feb 2024 00:25:05 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

8 months agoFix UI Spacing Errors in mirror settings (#28990)
yp05327 [Thu, 1 Feb 2024 00:04:23 +0000 (09:04 +0900)]
Fix UI Spacing Errors in mirror settings (#28990)

8 months agoAdd htmx guidelines (#28993)
Yarden Shoham [Wed, 31 Jan 2024 22:36:23 +0000 (00:36 +0200)]
Add htmx guidelines (#28993)

To make sure we don't abuse it.

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Co-authored-by: delvh <dev.lh@web.de>
8 months agoSome refactor for git http (#28995)
Lunny Xiao [Wed, 31 Jan 2024 15:23:22 +0000 (23:23 +0800)]
Some refactor for git http (#28995)

# Purpose

This PR makes git http related functions use the same `context.Context`
so they can be maintained easier.

8 months agoFix an actions schedule bug (#28942)
Zettat123 [Wed, 31 Jan 2024 14:55:12 +0000 (22:55 +0800)]
Fix an actions schedule bug (#28942)

In #28691, schedule plans will be deleted when a repo's actions unit is
disabled. But when the unit is enabled, the schedule plans won't be
created again.

This PR fixes the bug. The schedule plans will be created again when the
actions unit is re-enabled

8 months agoFix doc img path in profile readme (#28994)
yp05327 [Wed, 31 Jan 2024 13:32:17 +0000 (22:32 +0900)]
Fix doc img path in profile readme (#28994)

https://gitea.com/gitea/gitea-docusaurus/actions/runs/1007/jobs/0#jobstep-9-25

8 months agoIntroduce htmx and use it to avoid full page load on `Subscribe` and `Follow` (#28908)
Yarden Shoham [Tue, 30 Jan 2024 14:45:54 +0000 (16:45 +0200)]
Introduce htmx and use it to avoid full page load on `Subscribe` and `Follow` (#28908)

- Closes https://github.com/go-gitea/gitea/issues/28880

This change introduces htmx with the hope we could use it to make Gitea
more reactive while keeping our "HTML rendered on the server" approach.

- Add `htmx.js` that imports `htmx.org` and initializes error toasts
- Place `hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}'` on the
`<body>` tag so every request that htmx sends is authenticated
- Place `hx-swap="outerHTML"` on the `<body>` tag so the response of
each htmx request replaces the tag it targets (as opposed to its inner
content)
- Place `hx-push-url="false"` on the `<body>` tag so no changes to the
URL happen in `<form>` tags
- Add the `is-loading` class during request

### Error toasts in action

![errors](https://github.com/go-gitea/gitea/assets/20454870/181a1beb-1cb8-4858-abe8-fa1fc3f5b8f3)

## Don't do a full page load when clicking the subscribe button
- Refactor the form around the subscribe button into its own template
- Use htmx to perform the form submission
- `hx-boost="true"` to prevent the default form submission behavior of a
full page load
- `hx-sync="this:replace"` to replace the current request (in case the
button is clicked again before the response is returned)
  - `hx-target="this"` to replace the form tag with the new form tag
- Change the backend response to return a `<form>` tag instead of a
redirect to the issue page

### Before

![subscribe_before](https://github.com/go-gitea/gitea/assets/20454870/cb2439a2-c3c0-425c-8d3c-5d646b1cdc28)

### After

![subscribe_after](https://github.com/go-gitea/gitea/assets/20454870/6fcd77d8-7b11-40b0-af4f-b152aaad787c)

## Don't do a full page load when clicking the follow button
- Use htmx to perform the button request
- `hx-post="{{.ContextUser.HomeLink}}?action=follow"` to send a POST
request to follow the user
- `hx-target="#profile-avatar-card"` to target the card div for
replacement
- `hx-indicator="#profile-avatar-card"` to place the loading indicator
on the card
- Change the backend response to return a `<div>` tag (the card) instead
of a redirect to the user page

### Before

![follow_before](https://github.com/go-gitea/gitea/assets/20454870/a210b643-6e74-4ff9-8e61-d658c62edf1f)

### After

![follow_after](https://github.com/go-gitea/gitea/assets/20454870/5bb19ae9-0d59-4ae3-b538-4c83334e4722)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
Co-authored-by: 6543 <m.huber@kithara.com>
Co-authored-by: Giteabot <teabot@gitea.io>
8 months agoFix joins in `db.Find(AndCount)` (#28978)
KN4CK3R [Tue, 30 Jan 2024 02:37:24 +0000 (03:37 +0100)]
Fix joins in `db.Find(AndCount)` (#28978)

8 months agoUpdate golang links to use https (#28980)
Mike Cifelli [Tue, 30 Jan 2024 01:11:11 +0000 (20:11 -0500)]
Update golang links to use https (#28980)

Many of the golang links point to the old site and don't use https. This
pull request updates these outdated links to https://go.dev .

https://github.com/go-gitea/gitea/issues/28979

8 months agoFix google logo in security page (#28982)
Matheus Sampaio Queiroga [Tue, 30 Jan 2024 00:54:52 +0000 (21:54 -0300)]
Fix google logo in security page (#28982)

Fix google logo in user security page: #28701

Before

![before user security
page](https://github.com/go-gitea/gitea/assets/50121801/6c058c28-8013-470a-b047-f47afecdca09)

after

![user security
page](https://github.com/go-gitea/gitea/assets/50121801/36053ee9-18c5-4ef0-a63a-8accc1d00adc)

8 months agoAlso match weakly validated ETags (#28957)
cchangwen [Mon, 29 Jan 2024 16:18:40 +0000 (00:18 +0800)]
Also match weakly validated ETags (#28957)

https://stackoverflow.com/questions/51973120/where-does-the-w-in-an-etag-appear-from

https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag#

---------

Co-authored-by: delvh <dev.lh@web.de>
8 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 29 Jan 2024 00:24:21 +0000 (00:24 +0000)]
[skip ci] Updated licenses and gitignores

8 months agoFix bug for generated repository object format (#28969)
Lunny Xiao [Sun, 28 Jan 2024 20:18:15 +0000 (04:18 +0800)]
Fix bug for generated repository object format (#28969)

A repository generated from a template repository should have the same
git ObjectFormat.

8 months agoFixing small space missing in sample config file (#28967)
Arnaud Morin [Sun, 28 Jan 2024 14:58:00 +0000 (15:58 +0100)]
Fixing small space missing in sample config file (#28967)

8 months agoFix inconsistent naming of OAuth 2.0 `ENABLE` setting (#28951)
wackbyte [Sun, 28 Jan 2024 12:36:44 +0000 (07:36 -0500)]
Fix inconsistent naming of OAuth 2.0 `ENABLE` setting (#28951)

Renames it to `ENABLED` to be consistent with other settings and
deprecates it.

I believe this change is necessary because other setting groups such as
`attachment`, `cors`, `mailer`, etc. have an `ENABLED` setting, but
`oauth2` is the only one with an `ENABLE` setting, which could cause
confusion for users.

This is no longer a breaking change because `ENABLE` has been set as
deprecated and as an alias to `ENABLED`.

8 months agoAdd screenshot for "Profile Readmes" to docs (#28964)
6543 [Sat, 27 Jan 2024 23:20:17 +0000 (00:20 +0100)]
Add screenshot for "Profile Readmes" to docs (#28964)

introduced in #23260 ... the docs still looks to empty:
https://docs.gitea.com/usage/profile-readme

this changes it :)

8 months agoSimplify how git repositories are opened (#28937)
Lunny Xiao [Sat, 27 Jan 2024 20:09:51 +0000 (04:09 +0800)]
Simplify how git repositories are opened (#28937)

## Purpose
This is a refactor toward building an abstraction over managing git
repositories.
Afterwards, it does not matter anymore if they are stored on the local
disk or somewhere remote.

## What this PR changes
We used `git.OpenRepository` everywhere previously.
Now, we should split them into two distinct functions:

Firstly, there are temporary repositories which do not change:

```go
git.OpenRepository(ctx, diskPath)
```

Gitea managed repositories having a record in the database in the
`repository` table are moved into the new package `gitrepo`:

```go
gitrepo.OpenRepository(ctx, repo_model.Repo)
```

Why is `repo_model.Repository` the second parameter instead of file
path?
Because then we can easily adapt our repository storage strategy.
The repositories can be stored locally, however, they could just as well
be stored on a remote server.

## Further changes in other PRs
- A Git Command wrapper on package `gitrepo` could be created. i.e.
`NewCommand(ctx, repo_model.Repository, commands...)`. `git.RunOpts{Dir:
repo.RepoPath()}`, the directory should be empty before invoking this
method and it can be filled in the function only. #28940
- Remove the `RepoPath()`/`WikiPath()` functions to reduce the
possibility of mistakes.

---------

Co-authored-by: delvh <dev.lh@web.de>
8 months agoPreserve BOM in web editor (#28935)
silverwind [Sat, 27 Jan 2024 18:02:51 +0000 (19:02 +0100)]
Preserve BOM in web editor (#28935)

The `ToUTF8*` functions were stripping BOM, while BOM is actually valid
in UTF8, so the stripping must be optional depending on use case. This
does:

- Add a options struct to all `ToUTF8*` functions, that by default will
strip BOM to preserve existing behaviour
- Remove `ToUTF8` function, it was dead code
- Rename `ToUTF8WithErr` to `ToUTF8`
- Preserve BOM in Monaco Editor
- Remove a unnecessary newline in the textarea value. Browsers did
ignore it, it seems but it's better not to rely on this behaviour.

Fixes: https://github.com/go-gitea/gitea/issues/28743
Related: https://github.com/go-gitea/gitea/issues/6716 which seems to
have once introduced a mechanism that strips and re-adds the BOM, but
from what I can tell, this mechanism was removed at some point after
that PR.

8 months agoMake loading animation less aggressive (#28955)
Yarden Shoham [Sat, 27 Jan 2024 12:27:37 +0000 (14:27 +0200)]
Make loading animation less aggressive (#28955)

The current animation loops in a very fast manner, causing a slight
feeling of uncomfortableness. This change slows it a bit for a smoother
experience.

# Before

![before](https://github.com/go-gitea/gitea/assets/20454870/215a722d-feb4-4643-819d-c37a620c5e48)

# After

![after](https://github.com/go-gitea/gitea/assets/20454870/7acb1fab-9157-4f4d-8cc7-45fea0234b47)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8 months agoFix SSPI user creation (#28948)
KN4CK3R [Sat, 27 Jan 2024 09:27:34 +0000 (10:27 +0100)]
Fix SSPI user creation (#28948)

Fixes #28945

Setting the avatar is wrong and creating a random password is equal to
leave it empty.

8 months agoStrip `/` from relative links (#28932)
KN4CK3R [Sat, 27 Jan 2024 03:36:01 +0000 (04:36 +0100)]
Strip `/` from relative links (#28932)

Fixes #28915

Restores the old behaviour:

https://github.com/go-gitea/gitea/pull/26745/files#diff-d78a9d361b1fddc12218e4dd42f42d39d6be1fda184041e06bb6fb30f0d94c59L96

8 months agoFix non-alphabetic sorting of repo topics (#28938)
wackbyte [Fri, 26 Jan 2024 14:15:57 +0000 (09:15 -0500)]
Fix non-alphabetic sorting of repo topics (#28938)

8 months agoDon't remove all mirror repository's releases when mirroring (#28817)
Lunny Xiao [Fri, 26 Jan 2024 06:18:19 +0000 (14:18 +0800)]
Don't remove all mirror repository's releases when mirroring (#28817)

Fix #22066

# Purpose

This PR fix the releases will be deleted when mirror repository sync the
tags.

# The problem

In the previous implementation of #19125. All releases record in
databases of one mirror repository will be deleted before sync.
Ref:
https://github.com/go-gitea/gitea/pull/19125/files#diff-2aa04998a791c30e5a02b49a97c07fcd93d50e8b31640ce2ddb1afeebf605d02R481

# The Pros

This PR introduced a new method which will load all releases from
databases and all tags on git data into memory. And detect which tags
needs to be inserted, which tags need to be updated or deleted. Only
tags releases(IsTag=true) which are not included in git data will be
deleted, only tags which sha1 changed will be updated. So it will not
delete any real releases include drafts.

# The Cons

The drawback is the memory usage will be higher than before if there are
many tags on this repository. This PR defined a special release struct
to reduce columns loaded from database to memory.

8 months agoUse new RPM constants (#28931)
KN4CK3R [Thu, 25 Jan 2024 21:40:24 +0000 (22:40 +0100)]
Use new RPM constants (#28931)

https://github.com/sassoftware/go-rpmutils/pull/24 got merged.

8 months agoCheck for sha256 support to use --object-format flag (#28928)
John Olheiser [Thu, 25 Jan 2024 18:04:50 +0000 (12:04 -0600)]
Check for sha256 support to use --object-format flag (#28928)

This should fix https://github.com/go-gitea/gitea/issues/28927

Technically older versions of Git would support this flag as well, but
per https://github.com/go-gitea/gitea/pull/28466 that's the version
where using it (object-format=sha256) left "experimental" state.

`sha1` is (currently) the default, so older clients should be unaffected
in either case.

Signed-off-by: jolheiser <john.olheiser@gmail.com>
8 months agofix: update enable_prune even if mirror_interval is not provided (#28905) 24212/head
Anthony Quéré [Thu, 25 Jan 2024 12:51:32 +0000 (13:51 +0100)]
fix: update enable_prune even if mirror_interval is not provided (#28905)

Currently, the `updateMirror` function which update the mirror interval
and enable prune properties is only executed by the `Edit` function. But
it is only triggered if `opts.MirrorInterval` is not null, even if
`opts.EnablePrune` is not null.

With this patch, it is now possible to update the enable_prune property
with a patch request without modifying the mirror_interval.

## Example request with httpie

### Currently:
**Does nothing**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" -A bearer -a $gitea_token
```

**Updates both properties**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" "mirror_interval=10m" -A bearer -a $gitea_token
```

### With the patch
**Updates enable_prune only**
```bash
http PATCH https://gitea.your-server/api/v1/repos/myOrg/myRepo "enable_prune:=false" -A bearer -a $gitea_token
```

8 months agoImplement `MigrateRepository` for the actions notifier (#28920)
Zettat123 [Thu, 25 Jan 2024 12:06:29 +0000 (20:06 +0800)]
Implement `MigrateRepository` for the actions notifier (#28920)

Fixes #28699

This PR implements the `MigrateRepository` method for `actionsNotifier`
to detect the schedules from the workflow files in the migrated
repository.

8 months agoRespect branch info for relative links (#28909)
KN4CK3R [Thu, 25 Jan 2024 08:54:44 +0000 (09:54 +0100)]
Respect branch info for relative links (#28909)

Fix #28904

Co-authored-by: Giteabot <teabot@gitea.io>
8 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Thu, 25 Jan 2024 00:25:21 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

8 months agoShow in Web UI if file is vendored and generated (#28620)
JakobDev [Wed, 24 Jan 2024 05:51:37 +0000 (06:51 +0100)]
Show in Web UI if file is vendored and generated (#28620)

This simple shows in the Web UI is a file is vendored and/or generated.

![grafik](https://github.com/go-gitea/gitea/assets/15185051/bfe45fcc-cfec-4ba1-8d93-c0a262c3ae1c)

![grafik](https://github.com/go-gitea/gitea/assets/15185051/9f222a49-e7bf-4540-ba64-43dcc5767b76)

---------

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
8 months agoDon't reload timeline page when (un)resolving or replying conversation (#28654)
Jimmy Praet [Wed, 24 Jan 2024 03:26:28 +0000 (04:26 +0100)]
Don't reload timeline page when (un)resolving or replying conversation (#28654)

Fixes #15981

8 months agoAllow to sync tags from admin dashboard (#28045)
JakobDev [Wed, 24 Jan 2024 03:02:04 +0000 (04:02 +0100)]
Allow to sync tags from admin dashboard (#28045)

Inspired by #28043

This PR adds a option to the Admin Dashboard to sync all tags to the
database.

![grafik](https://github.com/go-gitea/gitea/assets/15185051/26ac51ef-82a4-4fd9-a6a6-5aefec612ff6)

8 months agoDon't run push mirrors for archived repos (#27140)
JakobDev [Wed, 24 Jan 2024 02:32:57 +0000 (03:32 +0100)]
Don't run push mirrors for archived repos (#27140)

Fixes https://codeberg.org/forgejo/forgejo/issues/612

At the moment push mirrors are still run if a repo is archived. This PR
fixes this.

8 months agoOnly migrate the first 255 chars of a Github issue title (#28902)
JakobDev [Wed, 24 Jan 2024 02:09:08 +0000 (03:09 +0100)]
Only migrate the first 255 chars of a Github issue title (#28902)

Fixes #28846

8 months agoFix hardcoded GitHub icon used as migrated release avatar (#28910)
wackbyte [Wed, 24 Jan 2024 01:07:13 +0000 (20:07 -0500)]
Fix hardcoded GitHub icon used as migrated release avatar (#28910)

8 months ago[skip ci] Updated translations via Crowdin
GiteaBot [Wed, 24 Jan 2024 00:25:44 +0000 (00:25 +0000)]
[skip ci] Updated translations via Crowdin

8 months agoUpdate go dependencies and fix go-git (#28893)
wxiaoguang [Tue, 23 Jan 2024 05:40:00 +0000 (13:40 +0800)]
Update go dependencies and fix go-git (#28893)

More details are in the comment of repo_base_gogit.go

And ref: https://github.com/go-git/go-git/issues/1006

8 months agoFix sort bug on repository issues list (#28897)
Lunny Xiao [Tue, 23 Jan 2024 01:17:42 +0000 (09:17 +0800)]
Fix sort bug on repository issues list (#28897)

Fix #28896

8 months agoUpgrade xorm to v1.3.7 to fix a resource leak problem caused by Iterate (#28891)
Lunny Xiao [Mon, 22 Jan 2024 10:24:55 +0000 (18:24 +0800)]
Upgrade xorm to v1.3.7 to fix a resource leak problem caused by Iterate (#28891)

Mainly fix an error https://gitea.com/xorm/xorm/issues/2393

8 months agoAdd missing exclusive in advanced label options (#28322)
Luca Zulberti [Mon, 22 Jan 2024 07:56:17 +0000 (08:56 +0100)]
Add missing exclusive in advanced label options (#28322)

Hi, I think these changes could be useful for default labels when
creating new repos.

The PR includes the following changes:
 - Add missing exclusive flag for Kind/ scope in labels.
 - Move Breaking label into new Compat/ scope.

8 months agoFix `DeleteCollaboration` transaction behaviour (#28886)
KN4CK3R [Mon, 22 Jan 2024 07:19:56 +0000 (08:19 +0100)]
Fix `DeleteCollaboration` transaction behaviour (#28886)

The method can't be called with an outer transaction because if the user
is not a collaborator the outer transaction will be rolled back even if
the inner transaction uses the no-error path.

`has == 0` leads to `return nil` which cancels the transaction. A
standalone call of this method does nothing but if used with an outer
transaction, that will be canceled.

8 months agoFix schedule not trigger bug because matching full ref name with short ref name ...
Lunny Xiao [Mon, 22 Jan 2024 02:13:24 +0000 (10:13 +0800)]
Fix schedule not trigger bug because matching full ref name with short ref name (#28874)

Fix #28533

Caused by #28691

8 months ago[skip ci] Updated licenses and gitignores
GiteaBot [Mon, 22 Jan 2024 00:26:33 +0000 (00:26 +0000)]
[skip ci] Updated licenses and gitignores

8 months agoPrevent anonymous container access if `RequireSignInView` is enabled (#28877)
KN4CK3R [Sun, 21 Jan 2024 16:31:29 +0000 (17:31 +0100)]
Prevent anonymous container access if `RequireSignInView` is enabled (#28877)

Fixes #28875

If `RequireSignInView` is enabled, the ghost user has no access rights.

8 months agoDon't show new pr button when page is not compare pull (#26431)
yp05327 [Sun, 21 Jan 2024 15:13:00 +0000 (00:13 +0900)]
Don't show new pr button when page is not compare pull (#26431)

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/ba69252f-3582-414a-9d62-b2b78d7035dd)
After:

![image](https://github.com/go-gitea/gitea/assets/18380374/71b8587c-b96e-48fb-b3e5-1a2a8b5d06fa)
(TestOrg:test is a tag not branch)

Problem:
In the template, we will not add `compare pull` class when
`PageIsComparePull` is false.

https://github.com/go-gitea/gitea/blob/a370efc13f0e1ea309e324639832832bc14cb6dc/templates/repo/diff/compare.tmpl#L2
But in the js, we are using `.repository.compare.pull` to find the
button:

https://github.com/go-gitea/gitea/blob/a370efc13f0e1ea309e324639832832bc14cb6dc/web_src/js/features/repo-legacy.js#L552-L563
So, if `PageIsComparePull` is false, the `New Pull Request` button will
be there, but has no response when we click it.

8 months agoAvoid duplicate JS error messages on UI (#28873)
wxiaoguang [Sun, 21 Jan 2024 14:23:08 +0000 (22:23 +0800)]
Avoid duplicate JS error messages on UI (#28873)

Gitea treat JS errors seriously, so sometimes the JS errors caused by
3rdparty code (eg: browser extensions) would also be reported on Gitea
UI: TypeError: WeakMap key undefined (caused by extension DarkReader's
bug) #28861

To avoid fill the user's screen with a lot of error messages, this PR
merges the same error messages into one, like this:

```js
<div class="page-content">
  <div class="... js-global-error" data-global-error-msg-compact="testmsg1" data-global-error-msg-count="2">test msg 1 (2)</div>
  <div class="... js-global-error" data-global-error-msg-compact="testmsg2" data-global-error-msg-count="1">test msg 2</div>
</div>
```

8 months agoFix branch list bug which displayed default branch twice (#28878)
Lunny Xiao [Sun, 21 Jan 2024 14:08:31 +0000 (22:08 +0800)]
Fix branch list bug which displayed default branch twice (#28878)

Fix #28876

8 months agoRevert adding htmx until we finaly decide to add it (#28879)
6543 [Sun, 21 Jan 2024 13:42:35 +0000 (14:42 +0100)]
Revert adding htmx until we finaly decide to add it (#28879)

8 months agoDon't do a full page load when clicking the follow button (#28872)
Yarden Shoham [Sat, 20 Jan 2024 22:37:22 +0000 (00:37 +0200)]
Don't do a full page load when clicking the follow button (#28872)

- Use htmx to perform the button request
- `hx-headers='{"x-csrf-token": "{{.CsrfToken}}"}'` to authenticate (we
should probably learn to reuse this)
- `hx-post="{{.ContextUser.HomeLink}}?action=follow"` to send a POST
request to follow the user
- `hx-target="#profile-avatar-card"` to target the card div for
replacement
- `hx-swap="outerHTML"` to replace the card (as opposed to its inner
content) with the new card that shows the new follower count and button
color
- Change the backend response to return a `<div>` tag (the card) instead
of a redirect to the user page

# Before

![before](https://github.com/go-gitea/gitea/assets/20454870/86899d15-41c9-42ed-bd85-253b9caac7f8)

# After

![after](https://github.com/go-gitea/gitea/assets/20454870/59455d96-548c-4a81-a5b0-fab1dc1e87ef)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8 months agoDon't do a full page load when clicking the subscribe button (#28871)
Yarden Shoham [Sat, 20 Jan 2024 19:44:51 +0000 (21:44 +0200)]
Don't do a full page load when clicking the subscribe button (#28871)

- Refactor the form around the subscribe button into its own template
- Use htmx to perform the form submission
- `hx-boost="true"` to prevent the default form submission behavior of a
full page load
- `hx-sync="this:replace"` to replace the current request (in case the
button is clicked again before the response is returned)
  - `hx-target="this"` to replace the form tag with the new form tag
  - `hx-push-url="false"` to disable a change to the URL
  - `hx-swap="show:no-scroll"` to preserve the scroll position
- Change the backend response to return a `<form>` tag instead of a
redirect to the issue page
- Include `htmx.org` in javascript imports

This change introduces htmx with the hope we could use it to make Gitea
more reactive while keeping our "HTML rendered on the server" approach.

# Before

![before](https://github.com/go-gitea/gitea/assets/20454870/4ec3e81e-4dbf-4338-9968-b0655c276d4c)

# After

![after](https://github.com/go-gitea/gitea/assets/20454870/8c8841af-9bfe-40b2-b1cd-cd1f3c90ba4d)

---------

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8 months agoFix incorrect PostgreSQL connection string for Unix sockets (#28865)
sdvcrx [Sat, 20 Jan 2024 16:04:47 +0000 (00:04 +0800)]
Fix incorrect PostgreSQL connection string for Unix sockets (#28865)

Fix #28864

8 months agoRun `npm audit fix` (#28866)
Yarden Shoham [Sat, 20 Jan 2024 15:37:32 +0000 (17:37 +0200)]
Run `npm audit fix` (#28866)

8 months agoFix migrate storage bug (#28830)
Lunny Xiao [Sat, 20 Jan 2024 15:27:31 +0000 (23:27 +0800)]
Fix migrate storage bug (#28830)

8 months agoSet the `isPermaLink` attribute to `false` in the `guid` sub-element (#28860)
Yarden Shoham [Sat, 20 Jan 2024 02:38:16 +0000 (04:38 +0200)]
Set the `isPermaLink` attribute to `false` in the `guid` sub-element (#28860)

Our `guid` is not a valid URL so according to the RSS spec the
`isPermaLink` attribute needs to be set to `false`.

Example:
```diff
<item>
  <title>yardenshoham opened issue &lt;a href=&#34;https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2&#34;&gt;yardenshoham/test#2&lt;/a&gt;</title>
  <link>https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</link>
  <description>2#hey</description>
  <content:encoded><![CDATA[2#hey]]></content:encoded>
  <author>yardenshoham</author>
- <guid>355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
+ <guid isPermaLink="false">355: https://3000-yardenshoham-gitea-jqlxjixsez9.ws-us107.gitpod.io/yardenshoham/test/issues/2</guid>
  <pubDate>Tue, 16 Jan 2024 18:54:36 +0000</pubDate>
</item>
```

References:
-
https://www.rssboard.org/rss-specification#ltguidgtSubelementOfLtitemgt
- Fixes https://github.com/go-gitea/gitea/issues/28734
- https://github.com/gorilla/feeds/issues/78
- https://github.com/go-gitea/gitea/pull/21550
- https://github.com/gorilla/feeds/pull/107

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
8 months agoIn administration documentation about environment variables, point to those for the...
Mechiel Lukkien [Sat, 20 Jan 2024 02:12:20 +0000 (03:12 +0100)]
In administration documentation about environment variables, point to those for the Go runtime instead of Go compiler (#28859)

The previous variables are used by the compiler and aren't too useful
for non-developers. The newly listed variables are more likely to be of
interest.

Apologies for this drive-by PR, I probably missed instructions from the
contributors guide. The patch can be regarded as a simple way to explain
the problem and solution. Feel free to close and possibly create a new
PR that does adhere to the contributors guide.

8 months agoMove doctor package from modules to services (#28856)
Lunny Xiao [Sat, 20 Jan 2024 02:07:31 +0000 (10:07 +0800)]
Move doctor package from modules to services (#28856)

8 months agoAdd support for sha256 repositories (#23894)
Adam Majer [Fri, 19 Jan 2024 16:05:02 +0000 (16:05 +0000)]
Add support for sha256 repositories (#23894)

Currently only SHA1 repositories are supported by Gitea. This adds
support for alternate SHA256 with the additional aim of easier support
for additional hash types in the future.

Fixes: #13794
Limited by: https://github.com/go-git/go-git/issues/899
Depend on: #28138

<img width="776" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/5448c9a7-608e-4341-a149-5dd0069c9447">

---------

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: 6543 <6543@obermui.de>
8 months agoFix incorrect action duration time when rerun the job before executed once (#28364)
yp05327 [Fri, 19 Jan 2024 14:05:49 +0000 (23:05 +0900)]
Fix incorrect action duration time when rerun the job before executed once (#28364)

Fix #28323
Reason was mentioned here:
https://github.com/go-gitea/gitea/issues/28323#issuecomment-1841867298

### Changes: (maybe breaking)
We can rerun jobs in Gitea, so there will be some problems in
calculating duration time.
In this PR, I use the exist `Started` and `Stopped` column to record the
last run time instead of the total time,
and add a new `PreviousDuration` column to record the previous duration
time.
You can also check the cost time of last run:

![image](https://github.com/go-gitea/gitea/assets/18380374/2ca39145-2c92-401a-b78b-43164f7ae061)

8 months agoFix some RPM registry flaws (#28782)
KN4CK3R [Fri, 19 Jan 2024 11:37:10 +0000 (12:37 +0100)]
Fix some RPM registry flaws (#28782)

Related #26984
(https://github.com/go-gitea/gitea/pull/26984#issuecomment-1889588912)

Fix admin cleanup message.
Fix models `Get` not respecting default values.
Rebuild RPM repository files after cleanup.
Do not add RPM group to package version name.
Force stable sorting of Alpine/Debian/RPM repository data.
Fix missing deferred `Close`.
Add tests for multiple RPM groups.
Removed non-cached `ReplaceAllStringRegex`.

If there are multiple groups available, it's stated in the package
installation screen:

![grafik](https://github.com/go-gitea/gitea/assets/1666336/8f132760-882c-4ab8-9678-77e47dfc4415)

8 months agotests: missing refs/ in bare repositories (#28844)
Adam Majer [Fri, 19 Jan 2024 07:12:21 +0000 (07:12 +0000)]
tests: missing refs/ in bare repositories (#28844)

Git 2.43.0 will not detect a git repository as valid without refs/
subdirectory present. `git gc` cleans this up and puts it in
packed-refs. We must keep refs/ non-empty.

8 months agoFix archive creating LFS hooks and breaking pull requests (#28848)
Brecht Van Lommel [Fri, 19 Jan 2024 05:49:18 +0000 (06:49 +0100)]
Fix archive creating LFS hooks and breaking pull requests (#28848)

When LFS hooks are present in gitea-repositories, operations like git
push for creating a pull request fail. These repositories are not meant
to include LFS files or git push them, that is handled separately. And
so they should not have LFS hooks.

Installing git-lfs on some systems (like Debian Linux) will
automatically set up /etc/gitconfig to create LFS hooks in repositories.
For most git commands in Gitea this is not a problem, either because
they run on a temporary clone or the git command does not create LFS
hooks.

But one case where this happens is git archive for creating repository
archives. To fix that, add a GIT_CONFIG_NOSYSTEM=1 to disable using the
system configuration for that command.

According to a comment, GIT_CONFIG_NOSYSTEM is not used for all git
commands because the system configuration can be intentionally set up
for Gitea to use.

Resolves #19810, #21148

8 months agoReturn `responseText` instead of string in some functions (#28836)
yp05327 [Fri, 19 Jan 2024 02:45:23 +0000 (11:45 +0900)]
Return `responseText` instead of string in some functions (#28836)

Follow
https://github.com/go-gitea/gitea/pull/28796#issuecomment-1891727591

8 months agoFix display latest sync time for pull mirrors on the repo page (#28841)
yp05327 [Thu, 18 Jan 2024 10:27:07 +0000 (19:27 +0900)]
Fix display latest sync time for pull mirrors on the repo page (#28841)

Follow #28712

1. Missing Locale word `mirror_sync`
2. Maybe forgot checking the conflict from #27760

Before:

![image](https://github.com/go-gitea/gitea/assets/18380374/6100d35b-7fe3-4095-9c24-7875568f7380)

After:

![image](https://github.com/go-gitea/gitea/assets/18380374/69647169-b812-45bc-a267-ab28f2df6ef6)

9 months agoAdd testing for CalcCommitStatus (#28823)
Lunny Xiao [Wed, 17 Jan 2024 13:27:59 +0000 (21:27 +0800)]
Add testing for CalcCommitStatus (#28823)

9 months agoRemove duplicated checkinit on git module (#28824)
Lunny Xiao [Wed, 17 Jan 2024 09:56:00 +0000 (17:56 +0800)]
Remove duplicated checkinit on git module (#28824)

`checkInit` has been invoked in `InitSimple`. So it's unnecessary to
invoke it twice in `InitFull`.

9 months agoAdd missing migration (#28827)
Lunny Xiao [Wed, 17 Jan 2024 09:26:45 +0000 (17:26 +0800)]
Add missing migration (#28827)

Missed from #28498

9 months agoFix uploaded artifacts should be overwritten (#28726)
FuXiaoHei [Wed, 17 Jan 2024 03:21:16 +0000 (11:21 +0800)]
Fix uploaded artifacts should be overwritten (#28726)

Fix `Uploaded artifacts should be overwritten`
https://github.com/go-gitea/gitea/issues/28549

When upload different content to uploaded artifact, it checks that
content size is not match in db record with previous artifact size, then
the new artifact is refused.

Now if it finds uploading content size is not matching db record when
receiving chunks, it updates db records to follow the latest size value.

9 months agoRetarget depending pulls when the parent branch is deleted (#28686)
Viktor Kuzmin [Wed, 17 Jan 2024 00:44:56 +0000 (03:44 +0300)]
Retarget depending pulls when the parent branch is deleted (#28686)

Sometimes you need to work on a feature which depends on another (unmerged) feature.
In this case, you may create a PR based on that feature instead of the main branch.
Currently, such PRs will be closed without the possibility to reopen in case the parent feature is merged and its branch is deleted.
Automatic target branch change make life a lot easier in such cases.
Github and Bitbucket behave in such way.

Example:
$PR_1$: main <- feature1
$PR_2$: feature1 <- feature2

Currently, merging $PR_1$ and deleting its branch leads to $PR_2$ being closed without the possibility to reopen.
This is both annoying and loses the review history when you open a new PR.

With this change, $PR_2$ will change its target branch to main ($PR_2$: main <- feature2) after $PR_1$ has been merged and its branch has been deleted.

This behavior is enabled by default but can be disabled.
For security reasons, this target branch change will not be executed when merging PRs targeting another repo.

Fixes #27062
Fixes #18408

---------

Co-authored-by: Denys Konovalov <kontakt@denyskon.de>
Co-authored-by: delvh <dev.lh@web.de>
9 months agoBump `@github/relative-time-element` to 4.3.1 (#28819)
Yarden Shoham [Tue, 16 Jan 2024 21:52:19 +0000 (23:52 +0200)]
Bump `@github/relative-time-element` to 4.3.1 (#28819)

- Fixes https://github.com/go-gitea/gitea/issues/28747

# Before

![image](https://github.com/go-gitea/gitea/assets/20454870/65d8dc84-680f-4c16-9aa1-b5986102e4e7)

# After

![image](https://github.com/go-gitea/gitea/assets/20454870/7cb288e7-ebde-4e94-a10a-cac28d6bdcfd)

Signed-off-by: Yarden Shoham <git@yardenshoham.com>
9 months agoFix reverting a merge commit failing (#28794)
Mihir Joshi [Tue, 16 Jan 2024 15:06:51 +0000 (20:36 +0530)]
Fix reverting a merge commit failing (#28794)

Fixes #22236

---
Error occurring currently while trying to revert commit using read-tree
-m approach:
> 2022/12/26 16:04:43 ...rvices/pull/patch.go:240:AttemptThreeWayMerge()
[E] [63a9c61a] Unable to run read-tree -m! Error: exit status 128 -
fatal: this operation must be run in a work tree
>   - fatal: this operation must be run in a work tree

We need to clone a non-bare repository for `git read-tree -m` to work.

https://github.com/go-gitea/gitea/commit/bb371aee6ecf5e570cdf7b5f7f0d6f47a607a325
adds support to create a non-bare cloned temporary upload repository.

After cloning a non-bare temporary upload repository, we [set default
index](https://github.com/go-gitea/gitea/blob/main/services/repository/files/cherry_pick.go#L37)
(`git read-tree HEAD`).
This operation ends up resetting the git index file (see investigation
details below), due to which, we need to call `git update-index
--refresh` afterward.

Here's the diff of the index file before and after we execute
SetDefaultIndex: https://www.diffchecker.com/hyOP3eJy/

Notice the **ctime**, **mtime** are set to 0 after SetDefaultIndex.

You can reproduce the same behavior using these steps:
```bash
$ git clone https://try.gitea.io/me-heer/test.git -s -b main
$ cd test
$ git read-tree HEAD
$ git read-tree -m 1f085d7ed8 1f085d7ed8 9933caed00
error: Entry '1' not uptodate. Cannot merge.
```

After which, we can fix like this:
```
$ git update-index --refresh
$ git read-tree -m 1f085d7ed8 1f085d7ed8 9933caed00
```

9 months agoRender code block in activity tab (#28816)
JakobDev [Tue, 16 Jan 2024 14:38:09 +0000 (15:38 +0100)]
Render code block in activity tab (#28816)

This is a little bugfix. Inline code is usually rendered in issue
titles, but it is missing in the activity tab.

Before:
![Screenshot 2024-01-16 at 14-20-51
Test](https://github.com/go-gitea/gitea/assets/15185051/383370f3-0fb2-49de-81cc-014e5cf86727)
After:

![grafik](https://github.com/go-gitea/gitea/assets/15185051/83eaf973-ce9a-44ce-beea-2db49fc8bd73)

9 months agoRemove trust model selection from repository creation on web page because it can...
Lunny Xiao [Tue, 16 Jan 2024 12:54:48 +0000 (20:54 +0800)]
Remove trust model selection from repository creation on web page because it can be changed in settings later (#28814)

As more and more options can be set for creating the repository, I don't
think we should put all of them into the creation web page which will
make things look complicated and confusing.

And I think we need some rules about how to decide which should/should
not be put in creating a repository page. One rule I can imagine is if
this option can be changed later and it's not a MUST on the creation,
then it can be removed on the page. So I found trust model is the first
one.

This PR removed the trust model selections on creating a repository web
page and kept others as before.
This is also a preparation for #23894 which will add a choice about SHA1
or SHA256 that cannot be changed once the repository created.