Commit graph

21643 commits

Author SHA1 Message Date
Otto ae8e8f388c Merge pull request 'i18n: Add dummy language for checking translation keys (#5785)' (#5786) from xtex/forgejo:dummy-lang into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5786
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-05 10:41:15 +00:00
Michael Kriese 64bf7f3696
test: enable gitea migration tests 2024-11-05 11:16:19 +01:00
xtex 42eed7dbea i18n: Add dummy language for checking translation keys (#5785) 2024-11-05 09:59:04 +00:00
Michael Kriese c68fcaf53d
test: enable github migration tests 2024-11-05 10:37:28 +01:00
Gergely Nagy cc03ac9e8f
chore(release-notes): notes for the week 2024-45 weekly cherry pick 2024-11-05 09:39:24 +01:00
Gergely Nagy 597f83c735
fix(tests): Fix TestMigrateActionsArtifacts()
Since we have artifact fixtures now, some ids are in use. To avoid
reusing IDs, start them at 42, rather than 0. That's past the ids used
by the fixtures.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-11-05 09:39:24 +01:00
Gergely Nagy ae6292ba38
chore: Fix a few lint errors
- Adjust `PrepareArtifactsStorage` to use `require.NoError` instead of
  `assert.NoError`
- Adjust `TestActionsArtifactDownload` to have the proper order of
  `assert.Equal` arguments.

Signed-off-by: Gergely Nagy <forgejo@gergo.csillger.hu>
2024-11-05 09:39:24 +01:00
Lunny Xiao 268276d4a7
Fix created_unix for mirroring (#32342)
Fix #32233

(cherry picked from commit 13a203828c40f9ad1005b16b4ae26256a7df8263)
2024-11-05 09:39:23 +01:00
Rowan Bohde befafe9a05
improve performance of diffs (#32393)
This has two major changes that significantly reduce the amount of work
done for large diffs:

* Kill a running git process when reaching the maximum number of files
in a diff, preventing it from processing the entire diff.
* When loading a diff with the URL param `file-only=true`, skip loading
stats. This speeds up loading both hidden files of a diff and sections
of a diff when clicking the "Show More" button.

A couple of minor things from profiling are also included:

* Reuse existing repo in `PrepareViewPullInfo` if head and base are the
same.

The performance impact is going to depend heavily on the individual diff
and the hardware it runs on, but when testing locally on a diff changing
100k+ lines over hundreds of files, I'm seeing a roughly 75% reduction
in time to load the result of "Show More"

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 7dcccc3bb19655a6f83dd495ffc332708d0c8678)
2024-11-05 09:39:21 +01:00
Kyle D. 748ae10e7c
Add artifacts test fixture (#30300)
Closes https://github.com/go-gitea/gitea/issues/30296

- Adds a DB fixture for actions artifacts
- Adds artifacts test files
- Clears artifacts test files between each run
- Note: I initially initialized the artifacts only for artifacts tests,
but because the files are small it only takes ~8ms, so I changed it to
always run in test setup for simplicity
- Fix some otherwise flaky tests by making them not depend on previous
tests

(cherry picked from commit 66971e591e5dddd5b6dc1572ac48f4e4ab29b8e0)

Conflicts:
	- tests/integration/api_actions_artifact_test.go
	  Conflict resolved by manually changing the tested artifact
	  name from "artifact" to "artifact-download"
	- tests/integration/api_actions_artifact_v4_test.go
	  Conflict resolved by manually updating the tested artifact
	  names, and adjusting the test case only present in our tree.
	- tests/test_utils.go
	  Resolved by manually copying the added function.
2024-11-05 09:33:15 +01:00
Zettat123 6b74043b85
Fix missing signature key error when pulling Docker images with SERVE_DIRECT enabled (#32365)
Fix #28121

I did some tests and found that the `missing signature key` error is
caused by an incorrect `Content-Type` header. Gitea correctly sets the
`Content-Type` header when serving files.

348d1d0f32/routers/api/packages/container/container.go (L712-L717)
However, when `SERVE_DIRECT` is enabled, the `Content-Type` header may
be set to an incorrect value by the storage service. To fix this issue,
we can use query parameters to override response header values.

https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html
<img width="600px"
src="https://github.com/user-attachments/assets/f2ff90f0-f1df-46f9-9680-b8120222c555"
/>

In this PR, I introduced a new parameter to the `URL` method to support
additional parameters.

```
URL(path, name string, reqParams url.Values) (*url.URL, error)
```

---

Most S3-like services support specifying the content type when storing
objects. However, Gitea always use `application/octet-stream`.
Therefore, I believe we also need to improve the `Save` method to
support storing objects with the correct content type.

b7fb20e73e/modules/storage/minio.go (L214-L221)
(cherry picked from commit 0690cb076bf63f71988a709f62a9c04660b51a4f)

Conflicts:
	- modules/storage/azureblob.go
	  Dropped the change, as we do not support Azure blob storage.
	- modules/storage/helper.go
	  Resolved by adjusting their `discardStorage` to our
	  `DiscardStorage`
	- routers/api/actions/artifacts.go
	  routers/api/actions/artifactsv4.go
	  routers/web/repo/actions/view.go
	  routers/web/repo/download.go
	  Resolved the conflicts by manually adding the new `nil`
	  parameter to the `storage.Attachments.URL()` calls.

	  Originally conflicted due to differences in the if expression
	  above these calls.
2024-11-05 09:33:15 +01:00
Oleksandr Redko 4aa61601c3
refactor: remove redundant err declarations (#32381)
(cherry picked from commit f4d3aaeeb9e1b11c5495e4608a3f52f316c35758)

Conflicts:
	- modules/charset/charset_test.go
	  Resolved by manually changing a `=` to `:=`, as per the
	  original patch. Conflict was due to `require.NoError`.
2024-11-05 09:33:15 +01:00
yp05327 2a38208004
Fix the missing menu in organization project view page (#32313)
#29248 didn't modify the view page.
The class name is not good enough, so this is a quick fix.

Before:
org:

![image](https://github.com/user-attachments/assets/3e26502d-66b4-4043-ab03-003ba7391487)
user:

![image](https://github.com/user-attachments/assets/9b22b90c-d63c-4228-acad-4d9fb20590ac)

After:
org:

![image](https://github.com/user-attachments/assets/21bf98a7-8a5b-4dc6-950a-88f529e36450)
user: (no change)

![image](https://github.com/user-attachments/assets/fea0dcae-3625-44e8-bb9e-4c3733da8764)

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit dd1f67491f5e2f798a537a61c082b1bf12e47635)
2024-11-05 09:33:15 +01:00
Royce Remer fe5adbbbdc
Add new [lfs_client].BATCH_SIZE and [server].LFS_MAX_BATCH_SIZE config settings. (#32307)
This contains two backwards-compatible changes:
* in the lfs http_client, the number of lfs oids requested per batch is
loaded from lfs_client#BATCH_SIZE and defaulted to the previous value of
20
* in the lfs server/service, the max number of lfs oids allowed in a
batch api request is loaded from server#LFS_MAX_BATCH_SIZE and defaults
to 'nil' which equates to the previous behavior of 'infinite'

This fixes #32306

---------

Signed-off-by: Royce Remer <royceremer@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit c60e4dc1095ef90a790582cacfad27c972637bb2)

Conflicts:
	- services/lfs/server.go
	  Conflict due to our Quota implementation. Resolved by manually
	  adding the change after the quota check.
2024-11-05 09:33:15 +01:00
Rowan Bohde e426ce257c
remove unused call to $.HeadRepo in view_title template (#32317)
This is only populated in
[`ParseCompareInfo`](https://github.com/search?q=repo%3Ago-gitea%2Fgitea%20%20.Data%5B%22HeadRepo%22%5D&type=code)
which is called in two handlers:

*
[`CompareAndPullRequestPost`](9206fbb55f/routers/web/repo/pull.go (L1246))
- a JSON post handler that doesn't render templates
*
[`CompareDiff`](9206fbb55f/routers/web/repo/compare.go (L706))
- which can render `diff/box.tmpl` and `diff/compare.tmpl`

(cherry picked from commit 1cd3f698591edf4fba7880a150b05855cdf40d47)
2024-11-05 09:33:15 +01:00
Lunny Xiao 42724b09c1
Fix clean tmp dir (#32360)
Try to fix #31792

Credit to @jeroenlaylo
Copied from
https://github.com/go-gitea/gitea/issues/31792#issuecomment-2311920520

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit feca8802b85dd75090c533ebdb92835d3d529f17)
2024-11-05 09:33:15 +01:00
6543 643f476e35
Optimize branch protection rule loading (#32280)
before if it was nonglob each load would try to glob it and the check
that is not glob ... now we only do that once and no future loading will
trigger it

---
*Sponsored by Kithara Software GmbH*

(cherry picked from commit 5d43801b72790ce5862aefdc4520edb06bb4cbba)
2024-11-05 09:33:15 +01:00
forgejo-renovate-action e40c8f0d21 Merge pull request 'Update linters to v8.13.0 (forgejo)' (#5815) from renovate/forgejo-linters into forgejo 2024-11-05 07:53:47 +00:00
forgejo-renovate-action 69eeb8369f Merge pull request 'Update dependency happy-dom to v15.8.5 (forgejo)' (#5813) from renovate/forgejo-happy-dom-15.x into forgejo 2024-11-05 07:53:08 +00:00
Renovate Bot 557612c4c1 Update linters to v8.13.0 2024-11-05 06:03:59 +00:00
Renovate Bot 8838f010b9 Update dependency happy-dom to v15.9.0 2024-11-05 06:03:49 +00:00
Renovate Bot 0f394fd9e4 Update dependency globals to v15.12.0 (forgejo) (#5814)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5814
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-11-05 05:56:49 +00:00
Earl Warren 407396cde0 Merge pull request 'Add label to Forgejo Actions PR labeled/unlabeled events and update the commit status' (#5778) from earl-warren/forgejo:wip-label-status into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5778
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-04 14:09:23 +00:00
Earl Warren f56fc51c74
chore(release-notes): related pull requests workflow fixes 2024-11-04 12:10:15 +01:00
Otto 1418ac176d Merge pull request '[PORT] Fix git error handling (gitea#32401)' (#5794) from gusted/forgejo-port-32401 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5794
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-04 10:40:07 +00:00
Earl Warren 66c85b7d8b
fix: Actions PR workflows must update the commit status
When a workflow has

on:
  pull_request:
    types:
      - labeled
      - unlabeled

The outcome of the workflow (success or failure) must be associated
with the head sha commit status. Otherwise it cannot be used as a
requirement for merging the pull request (branch protections).
2024-11-04 11:27:14 +01:00
Earl Warren 58e3c1fbdb
fix: add label to issues and PR labeled/unlabeled events
When a workflow has

on:
  pull_request:
    types:
      - labeled
      - unlabeled

The payload misses the label field describing the added or removed
label.

The unlabeled event type was also incorrectly mapped to the labeled
event type.
2024-11-04 10:41:11 +01:00
Gusted 14fe3c36bf Merge pull request '[PORT] Fix a number of typescript issues (gitea#32308)' (#5791) from gusted/forgejo-port-32308 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5791
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-04 08:44:57 +00:00
silverwind 3bdca4615c
[PORT] Fix a number of typescript issues (gitea#32308)
- Prefer
[window.location.assign](https://developer.mozilla.org/en-US/docs/Web/API/Location/assign)
over assigning to
[window.location](https://developer.mozilla.org/en-US/docs/Web/API/Window/location)
which typescript does not like. This works in all browsers including
PaleMoon.
- Fix all typescript issues in `web_src/js/webcomponents`, no behaviour
changes.
- ~~Workaround bug in `@typescript-eslint/no-unnecessary-type-assertion`
rule.~~
- Omit vendored file from type checks.
- `tsc` error count is reduce by 53 with these changes.

---
Conflict resolution: Choose our version.
Done differently: Everything related to typescript types isn't ported.
Use `window.location.href` instead of `String(window.location)`, thanks
@viceice!

(cherry picked from commit 810782302652d73c4f7249c4c3df8a7e85bae5f0)
2024-11-04 09:15:06 +01:00
forgejo-renovate-action a32d6bf768 Merge pull request 'Update linters (forgejo)' (#5774) from renovate/forgejo-linters into forgejo 2024-11-04 07:00:49 +00:00
forgejo-renovate-action 9dfd73fcc5 Merge pull request 'Update dependency happy-dom to v15.8.3 (forgejo)' (#5803) from renovate/forgejo-happy-dom-15.x into forgejo 2024-11-04 07:00:08 +00:00
Renovate Bot 2266e14f38 Update linters 2024-11-04 06:04:10 +00:00
Renovate Bot fbfb804b29 Update dependency happy-dom to v15.8.3 2024-11-04 06:03:59 +00:00
Renovate Bot 6e1c0e4cb0 Lock file maintenance (forgejo) (#5804)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5804
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-11-04 05:54:02 +00:00
Renovate Bot fb1b3e2c6d Update renovate to v38.142.5 (forgejo) (#5802)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5802
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-11-04 05:52:26 +00:00
Earl Warren cea08caea3 Merge pull request 'fix: support www.github.com for migrations' (#5795) from viceice/fix/github-migration into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5795
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-11-03 17:27:35 +00:00
wxiaoguang fddde93759
[PORT] Replace DateTime with proper functions (gitea#32402)
Follow https://github.com/go-gitea/gitea/pull/32383

This PR cleans up the "Deadline" usages in templates, make them call
`ParseLegacy` first to get a `Time` struct then display by `DateUtils`.

Now it should be pretty clear how "deadline string" works, it makes it
possible to do further refactoring and correcting.

(cherry picked from commit 259811617ba15c77ddd89360178a59251d611af2)
2024-11-03 17:03:14 +01:00
wxiaoguang 498b5f9867
[PORT] Refactor the DB migration system slightly (gitea#32344)
Introduce "idNumber" for each migration, and clarify the difference
between the migration ID number and database version.

---
Conflict resolution: trivial

(cherry picked from commit d70af38447a759d4a935e315e18efa4dd625f655)
2024-11-03 17:00:48 +01:00
wxiaoguang 171de4d107
[PORT] Fix git error handling (gitea#32401)
---
Conflict resolution: Trivial, for `repo_attributes.go` move where the
`IsErrCanceledOrKilled` needs to happen because of other changes that
happened in this file.

To add some words to this change: It seems to be mostly simplifying the
error handling of git operations.

(cherry picked from commit e524f63d58900557d7d57fc3bcd19d9facc8b8ee)
2024-11-03 16:47:44 +01:00
wxiaoguang f2eabf6308
[PORT] Replace DateTime with DateUtils (gitea#32383)
(cherry picked from commit fec6b3d50072e48bb51c18c5c4ea682dc6319573)
2024-11-03 16:37:01 +01:00
Michael Kriese 284ffe4e00
fix: support www.github.com for migrations 2024-11-03 16:08:58 +01:00
wxiaoguang 9b442172fb
[PORT] Fix toAbsoluteLocaleDate and add more tests (gitea#32387)
---
Conflict resolution: None
Done differently: Removed typescript types.

(cherry picked from commit aee9801d468997ab3cce32978416b697d9df77a7)
2024-11-03 15:55:05 +01:00
wxiaoguang bdd75c4b55
[PORT] Fix absolute-date (gitea#32375)
---
Conflict resolution: Trivial (package.json package-lock.json)
Done differently: Removed typescript types.

(cherry picked from commit ce4d909bd693fe903761eb835f7661e476a937ca)
2024-11-03 15:55:02 +01:00
Gusted 20c0a2a381 Merge pull request 'chore(cleanup): remove unused TestCreateFile' (#5788) from earl-warren/forgejo:wip-create-file-cleanup into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5788
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-11-03 13:29:04 +00:00
forgejo-renovate-action 019f3b038a Merge pull request 'Update dependency eslint-plugin-array-func to v5 (forgejo)' (#5784) from renovate/forgejo-eslint-plugin-array-func-5.x into forgejo 2024-11-03 11:38:50 +00:00
Renovate Bot 60f8a12877 Update dependency eslint-plugin-array-func to v5 2024-11-03 10:03:24 +00:00
Earl Warren c5c1d593ad
chore(cleanup): remove unused TestCreateFile
Since CreateDeclarativeRepoWithOptions it is more convenient to create
a file by providing arguments.
2024-11-03 10:00:58 +01:00
Earl Warren ca3ff29068 Merge pull request 'Update module github.com/gorilla/sessions to v1.4.0 (forgejo)' (#5783) from renovate/forgejo-github.com-gorilla-sessions-1.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5783
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-11-03 08:35:13 +00:00
Earl Warren 792c85cf9b Merge pull request 'Update actions/git-backporting action to v4.8.4 (forgejo)' (#5782) from renovate/forgejo-actions-git-backporting-4.x into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5782
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-03 08:08:21 +00:00
Earl Warren a04dfb041e
chore(license): Update module github.com/gorilla/sessions to v1.4.0 2024-11-03 09:00:22 +01:00