Commit graph

21478 commits

Author SHA1 Message Date
Earl Warren
2541a943ce
bug: require.Eventually must not test with assert
Otherwise it fails the test instead of retrying if the condition fails
at least once.
2024-11-09 00:07:18 +01:00
Otto
30f795d925 Merge pull request '[PORT] Refactor tests to prevent from unnecessary preparations (gitea#32398)' (#5790) from gusted/forgejo-port-32398 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5790
Reviewed-by: Otto <otto@codeberg.org>
2024-11-07 23:26:22 +00:00
wxiaoguang
3c4153b195
[PORT] Refactor tests to prevent from unnecessary preparations (gitea#32398)
Some preparations are only used by a few tests, so to make the tests fast, they should only be prepared when they are used.

By the way, this PR splits PrepareTestEnv into small functions to make it simple.

---

Conflict resolution: Mostly magical and just re-pasting the code into
the right places.
Done differently: use `require.NoError` instead of `assert.NoError`.

(cherry picked from commit ec2d1593c269e06655525deb96f74b8094221b6f)
2024-11-07 23:02:10 +01:00
Earl Warren
5e777a43a1 Merge pull request 'fix: issue labels are not set after deleting one label' (#5843) from earl-warren/forgejo:wip-unlabeled into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5843
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-07 10:36:45 +00:00
Earl Warren
f06bdb0552
chore(refactor): split ReloadLabels out of LoadLabels in issue model
Functions modifying the labels in the database (DeleteIssueLabel,
NewIssueLabels, NewIssueLabel, ReplaceIssueLabels) need to force
reload them. Instead of:

	issue.isLabelsLoaded = false
	issue.Labels = nil
	if err = issue.LoadLabels(ctx); err != nil {
		return err
	}

They can now use:

	if err = issue.ReloadLabels(ctx); err != nil {
		return err
	}
2024-11-07 11:05:38 +01:00
Earl Warren
db899c19d8
fix: issue labels are not set after deleting one label
Because issue.isLabelsLoaded = false is missing, LoadLabels is a noop
and the issue.Labels is nil.
2024-11-07 10:38:01 +01:00
Renovate Bot
7da6778ce1 Update dependency eslint-plugin-playwright to v2.0.1 (forgejo) (#5837)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-11-07 07:52:50 +00:00
Codeberg Translate
600be26638 i18n: update of translations from Codeberg Translate (#5754)
Co-authored-by: Juno Takano <jutty@users.noreply.translate.codeberg.org>
Co-authored-by: Outbreak2096 <Outbreak2096@users.noreply.translate.codeberg.org>
Co-authored-by: Benedikt Straub <Nordfriese@users.noreply.translate.codeberg.org>
Co-authored-by: Edgarsons <Edgarsons@users.noreply.translate.codeberg.org>
Co-authored-by: 0ko <0ko@users.noreply.translate.codeberg.org>
Co-authored-by: Fjuro <fjuro@alius.cz>
Co-authored-by: SomeTr <SomeTr@users.noreply.translate.codeberg.org>
Co-authored-by: Atalanttore <Atalanttore@users.noreply.translate.codeberg.org>
Co-authored-by: Anonymous <anonymous@users.noreply.translate.codeberg.org>
Co-authored-by: Dirk <Dirk@users.noreply.translate.codeberg.org>
Co-authored-by: xtex <xtexchooser@duck.com>
Co-authored-by: artnay <artnay@users.noreply.translate.codeberg.org>
Co-authored-by: WithLithum <WithLithum@users.noreply.translate.codeberg.org>
Co-authored-by: dobrvlskyi <dobrvlskyi@users.noreply.translate.codeberg.org>
Co-authored-by: earl-warren <earl-warren@users.noreply.translate.codeberg.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5754
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Co-authored-by: Codeberg Translate <translate@noreply.codeberg.org>
Co-committed-by: Codeberg Translate <translate@noreply.codeberg.org>
2024-11-07 07:22:37 +00:00
Renovate Bot
ee5d1cf876 Update dependency happy-dom to v15.11.0 (forgejo) (#5840)
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2024-11-07 06:40:27 +00:00
Earl Warren
18cf8adc71 Merge pull request 'Update dependency go to v1.23.3 (forgejo)' (#5836) from renovate/forgejo-patch-golang-packages into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5836
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2024-11-07 06:38:35 +00:00
Renovate Bot
94650c27a8 Update dependency go to v1.23.3 2024-11-07 00:03:28 +00:00
Otto
019083ed5a Merge pull request 'Make direnv optional to let developers use their own direnv configuration' (#5835) from psentee/forgejo:psentee/make-envrc-optional into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5835
Reviewed-by: Otto <otto@codeberg.org>
2024-11-06 20:31:09 +00:00
Maciej Pasternacki
ffcf80c3a5 Make direnv optional to let developers use their own direnv configuration 2024-11-06 20:34:49 +01:00
Earl Warren
a97ec9bd83 Merge pull request 'fix: labels are missing in the pull request payload removing a label' (#5831) from earl-warren/forgejo:wip-unlabeled into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5831
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-11-06 17:37:07 +00:00
Earl Warren
c801838690
fix: labels are missing in the pull request payload removing a label
When ReplaceIssueLabels calls issue.LoadLabels it was a noop because
issue.isLabelsLoaded is still set to true because of the call  to
issue.LoadLabels that was done at the beginning of the function.
2024-11-06 16:43:14 +01:00
Earl Warren
85ff5ecafd Merge pull request 'chore(renovate): fix regex' (#5832) from viceice/chore/renovate into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5832
Reviewed-by: Otto <otto@codeberg.org>
2024-11-06 15:41:13 +00:00
Michael Kriese
968ca15f06
chore(renovate): fix regex 2024-11-06 15:58:44 +01:00
Otto
4e009474e0 Merge pull request 'chore(renovate): use squash for automerge' (#5830) from viceice/chore/renovate into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5830
Reviewed-by: Otto <otto@codeberg.org>
2024-11-06 14:44:48 +00:00
Michael Kriese
8bb33b2c4c
chore(renovate): use squash for automerge
We don't sign commits, so no benefit for a merge commit.
2024-11-06 15:42:07 +01:00
Renovate Bot
8b27dcb3b6 Update renovate to v39 (forgejo) (major) (#5829)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5829
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-06 14:39:53 +00:00
Otto
0fb48872ac Merge pull request '[FEAT] Trim spaces from repo names on form submission' (#5822) from gusted/forgejo-trim-spaces-form into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5822
Reviewed-by: Otto <otto@codeberg.org>
2024-11-06 09:16:17 +00:00
Earl Warren
36b18fb6cc Merge pull request '[gitea] week 2024-45 cherry pick (gitea/main -> forgejo)' (#5789) from algernon/wcp/2024-45 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5789
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-11-06 08:57:43 +00:00
forgejo-renovate-action
b68c98ff3e Merge pull request 'Update dependency happy-dom to v15.10.0 (forgejo)' (#5825) from renovate/forgejo-happy-dom-15.x into forgejo 2024-11-06 08:03:09 +00:00
Renovate Bot
104a1b6fca Update dependency happy-dom to v15.10.1 2024-11-06 02:03:49 +00:00
forgejo-renovate-action
473270bbdb Merge pull request 'Update dependency djlint to v1.36.0 (forgejo)' (#5824) from renovate/forgejo-djlint-1.x into forgejo 2024-11-06 00:52:31 +00:00
Renovate Bot
329650a9b4 Update dependency djlint to v1.36.0 2024-11-06 00:03:27 +00:00
Gusted
4952747699
[FEAT] Trim spaces from repository name
- This uses the `TrimSpace` preprocessing of the binding library to
remove any accidental spaces from the input.
- Integration test added.
- Resolves #4309
2024-11-05 23:13:17 +01:00
Gusted
310376525b
[CHORE] Use forked binding library
- Use the forked [binding](https://code.forgejo.org/go-chi/binding)
library. This library has two benefits, it removes the usage of
`github.com/goccy/go-json` (has no benefit as the minimo library is also
using it). It adds the `TrimSpace` feature, which will during the
binding part trim the spaces around the value it got from the form, this
is done before validation.
2024-11-05 22:47:34 +01:00
Otto
f28e728317 Merge pull request '[PORT] Replace DateTime with proper functions (gitea#32402)' (#5796) from gusted/forgejo-port-dateutils into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5796
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-05 21:46:29 +00:00
Otto
cd0ac4181e Merge pull request 'chore(ci): deprecate legacy infrastructure supporting v*.next' (#5820) from earl-warren/forgejo:wip-next-digest into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5820
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-05 21:42:34 +00:00
Gusted
2f8e7a2c67
[CHORE] Add extra testing
- Do more property testing for null values.
- Add test for `AbsoluteLong`.
2024-11-05 21:20:55 +01:00
Gusted
25c7c531f5 Merge pull request '[PORT] Refactor the DB migration system slightly (gitea#32344)' (#5793) from gusted/forgejo-port-32344 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5793
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-05 20:15:11 +00:00
Gusted
d5a1188086 Merge pull request 'feat: add partial quoting' (#5677) from gusted/forgejo-partial-qouting into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5677
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-05 20:13:04 +00:00
Earl Warren
ece87d0569
chore(ci): deprecate legacy infrastructure supporting v*.next
https://code.forgejo.org/infrastructure/k8s/ was replaced with
https://code.forgejo.org/infrastructure/k8s-cluster/
2024-11-05 16:18:06 +01:00
Michael Kriese
c8ba330833 Merge pull request 'test: enable gitea migration tests' (#5817) from viceice/test/migrations/gitea into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5817
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-11-05 10:55:30 +00:00
Michael Kriese
f6dbb97a30 Merge pull request 'test: enable github migration tests' (#5816) from viceice/test/migrations/github into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5816
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-11-05 10:54:05 +00:00
Gusted
7252445b4c Merge pull request '[PORT] Fix toAbsoluteLocaleDate and add more tests (gitea#32387)' (#5792) from gusted/forgejo-port-data-time into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5792
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2024-11-05 10:46:14 +00:00
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