0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-02-22 13:57:46 -05:00
Commit graph

4999 commits

Author SHA1 Message Date
Gusted
15aa35a809
fix(i18n): use translate key as fallback
- If the translate key is nonsense (not seen in any of the languages)
then the translate key as-is should be returned as value, this helps
during development. Currently it displays the first entry of the locale
store which is "Home".
- Regression from forgejo/forgejo#6203.
- Added unit test.
2025-01-28 15:03:38 +01:00
Gusted
270a2c7fa3 chore: remove usages of sort.Sort (#6689)
improve language stats rounding:

- Add tests (I had to omit some edge cases as the current method is
non-determistic in some cases, due to random order of map access).
- Document the algorithm used.
- Lower the amount of calculations that need to be done.
- Because of the aforementioned non-determistic don't use stable sort
and instead regular sort.

better sorting for `RepositoryList`:

- Add testing
- Use `slices.Sortfunc` instead of `sort.Sort`.
- Remove the methods needed for `sort.Sort`.

better git tag sorter:

- Use `slices.SortFunc` instead of `sort.Sort`.
- Remove `tagSorter` and its related methods.
- Added testing.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6689
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-01-26 13:30:00 +00:00
Earl Warren
048af05db9 [gitea] week 2025-04 cherry pick (gitea/main -> forgejo) (#6623)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6623
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: Shiny Nematoda <snematoda@noreply.codeberg.org>
2025-01-26 08:43:07 +00:00
Robert Wolff
95f231612b fix: inline file preview for rendered files (#6572)
This fixes the inline file preview for rendered files (e.g., markdown). [Here, a live issue in v11](https://v11.next.forgejo.org/mahlzahn/test-inline-file-preview/issues/1) and [the same in v7 (with even more bugs)](https://v7.next.forgejo.org/mahlzahn/test-inline-file-preview/issues/1).

It fixes
1. the inline preview for possibly rendered files, when the link is specified with `?display=source`. This happens, e.g., if you are watching a (e.g., markdown) file in source and then want to link some of its lines.
2. the link to the source file inside the inline preview for possible rendered files (currently it links to the rendered version and then the `#L…` cannot point to the correct lines). This is done by always adding `?display=source` to the link.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6572
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Robert Wolff <mahlzahn@posteo.de>
Co-committed-by: Robert Wolff <mahlzahn@posteo.de>
2025-01-25 08:11:37 +00:00
Gusted
443f7d59f9 chore: teach set module about iter.Seq (#6676)
- Add a new `Seq` function to the `Set` type, this returns an iterator over the values.
- Convert some users of the `Values` method to allow for more optimal code.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6676
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-01-24 16:45:46 +00:00
Gusted
46e60ce966 fix: load settings for valid user and email check (#6674)
- The doctor commands to check the validity of existing usernames and
email addresses depend on functionality that have configurable behavior
depending on the values of the `[service]` settings, so load them when
running the doctor command.
- Resolves #6664
- No unit test due to the architecture of doctor commands.

# Testing

1. Set `[service].ALLOW_DOTS_IN_USERNAMES = true`.
2. Create a user that contains a dot in their username.
3. Run the `check-user-name` doctor command and verify there's no error reported.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6674
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-01-24 12:23:15 +00:00
0ko
8178b4e98b chore: fix typos, decap a few i18n strings (#6666)
A few typos, some from spell checker, some from grepping `the the`, `the a `, ` a the`. Some in comments and some in changelogs.

Decapped a few remaining annoying strings, and one new from https://codeberg.org/forgejo/forgejo/pulls/6351 which was introduced by copy-pasting on a slightly out-of-date branch, causing Weblate to issue "reused translation" alerts again. Ref #6439.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6666
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: 0ko <0ko@noreply.codeberg.org>
Co-committed-by: 0ko <0ko@noreply.codeberg.org>
2025-01-24 05:41:59 +00:00
Gusted
a9c97110f9 feat: add configurable cooldown to claim usernames (#6422)
Add a new option that allows instances to set a cooldown period to claim
old usernames. In the context of public instances this can be used to
prevent old usernames to be claimed after they are free and allow
graceful migration (by making use of the redirect feature) to a new
username. The granularity of this cooldown is a day. By default this
feature is disabled and thus no cooldown period.

The `CreatedUnix` column is added the `user_redirect` table, for
existing redirects the timestamp is simply zero as we simply do not know
when they were created and are likely already over the cooldown period
if the instance configures one.

Users can always reclaim their 'old' user name again within the cooldown
period. Users can also always reclaim 'old' names of organization they
currently own within the cooldown period.

Creating and renaming users as an admin user are not affected by the
cooldown period for moderation and user support reasons.

To avoid abuse of the cooldown feature, such that a user holds a lot of
usernames, a new option is added `MAX_USER_REDIRECTS` which sets a limit
to the amount of user redirects a user may have, by default this is
disabled. If a cooldown period is set then the default is 5. This
feature operates independently of the cooldown period feature.

Added integration and unit testing.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6422
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-01-24 04:16:56 +00:00
Alex619829
7ae5376573 Alt Linux Apt-Rpm repository support for Forgejo packages. (#6351)
Co-authored-by: Aleksandr Gamzin alexgamz1119@gmail.com

Adds support for the Apt-Rpm registry of the Alt Lunux distribution.

Alt Linux uses RPM packages to store and distribute software to its users. But the logic of the Alt Linux package registry is different from the Red Hat package registry.
I have added support for the Alt Linux package registry.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [x] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [ ] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Co-authored-by: Aleksandr Gamzin <gamzin@altlinux.org>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6351
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Alex619829 <alex619829@noreply.codeberg.org>
Co-committed-by: Alex619829 <alex619829@noreply.codeberg.org>
2025-01-22 14:01:49 +00:00
Earl Warren
c92fe83c40 fix: teach the doctor about orphaned two_factor rows (#6639)
If a row in the two_factor table references a non existent user, it may contain a secret that has an invalid format. Such an orphaned row is never used and should be removed.

Improve the error message to suggest using the doctor to remove it.

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

## Testing

- make TAGS='sqlite sqlite_unlock_notify' watch
- make TAGS='sqlite  sqlite_unlock_notify' forgejo
- sqlite3 data/gitea.db 'INSERT INTO two_factor VALUES( 0, 500, "", "", "", "", 0, 0)'
- ./forgejo doctor check --run check-db-consistency
  ```
   [1] Check consistency of database
    - [W] Found 1 Orphaned TwoFactor without existing User
   OK

   All done (checks: 1).
   ```
-  ./forgejo doctor check --run check-db-consistency --fix
   ```
   [1] Check consistency of database
    - [I] Deleted 1 Orphaned TwoFactor without existing User
   OK

   All done (checks: 1).
   ```

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [ ] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Bug fixes
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/6639): <!--number 6639 --><!--line 0 --><!--description VGVhY2ggdGhlIGRvY3RvciB0byByZW1vdmUgb3JwaGFuZWQgdHdvX2ZhY3RvciB3aXRoIGBmb3JnZWpvIGRvY3RvciBjaGVjayAtLXJ1biBjaGVjay1kYi1jb25zaXN0ZW5jeSAtLWZpeGAuIFN1Y2ggcm93cyBtYXkgY29udGFpbiBpbnZhbGlkIGRhdGEgYW5kIFtibG9jayB0aGUgbWlncmF0aW9uIHRvIHYxMF0oaHR0cHM6Ly9jb2RlYmVyZy5vcmcvZm9yZ2Vqby9mb3JnZWpvL2lzc3Vlcy82NjM3KSB3aXRoIGEgbWVzc2FnZSBzdWNoIGFzIGBmYWlsZWQ6IEFlc0RlY3J5cHQgaW52YWxpZCBkZWNyeXB0ZWQgYmFzZTY0IHN0cmluZzogaWxsZWdhbCBiYXNlNjQgZGF0YSBhdCBpbnB1dCBieXRlIDBgLg==-->Teach the doctor to remove orphaned two_factor with `forgejo doctor check --run check-db-consistency --fix`. Such rows may contain invalid data and [block the migration to v10](https://codeberg.org/forgejo/forgejo/issues/6637) with a message such as `failed: AesDecrypt invalid decrypted base64 string: illegal base64 data at input byte 0`.<!--description-->
<!--end release-notes-assistant-->

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6639
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-01-21 17:30:08 +00:00
ThomasBoom89
5be7c6cbd8 feat: implement migration of website field from gogs/gitea/github (#6474)
* cleanup: remove not used properties
* feat: implement migration of website field from gogs
* feat: implement dumping and restoring website field
* feat: implement migration of website field from gitea
* feat: implement migration of homepage/website field from github
* feat: implement website properties for repository migration

Gogs migration is untested for now.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6474
Reviewed-by: Otto <otto@codeberg.org>
Co-authored-by: ThomasBoom89 <thomasboom89@noreply.codeberg.org>
Co-committed-by: ThomasBoom89 <thomasboom89@noreply.codeberg.org>
2025-01-20 12:18:19 +00:00
hiifong
ae51a90181
Fix parentCommit invalid memory address or nil pointer dereference. (#33204)
When the parent Commit does not exist on gitea, an error will be
reported when opening the Commit details page: invalid memory address or
nil pointer dereference.

![image](https://github.com/user-attachments/assets/4c2a9802-935f-41e9-b5b9-a4f0d745f709)

![image](https://github.com/user-attachments/assets/7b0bc15e-7f5f-4d58-8d24-fee667a799fa)

(cherry picked from commit b7614e2d2f2af246e33b8bd6a38ecfd1babc9ecc)
2025-01-19 11:52:09 +01:00
Lunny Xiao
574ff84967
Fix mirror bug (#33224)
Fix #33200

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit be4e961240883778c44d9651eaaf9ab8723bbbb0)
2025-01-19 09:42:57 +01:00
Benedikt Straub
a2787bb09e
Initial support for localization and pluralization with go-i18n-JSON-v2 format 2025-01-17 11:21:28 +01:00
Gusted
b2a3a0411c [PORT] Remove SHA1 for support for ssh rsa signing (#31857) (#5303)
https://github.com/go-fed/httpsig seems to be unmaintained.

Switch to github.com/42wim/httpsig which has removed deprecated crypto
and default sha256 signing for ssh rsa.

No impact for those that use ed25519 ssh certificates.

This is a breaking change for:
- gitea.com/gitea/tea (go-sdk) - I'll be sending a PR there too
- activitypub using deprecated crypto (is this actually used?)

(cherry picked from commit 01dec7577a051d9bb30e91f6cf6653dc51a37d06)

---
Conflict resolution: trivial

Co-authored-by: Wim <wim@42.be>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/5303
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
2025-01-17 03:17:10 +00:00
Earl Warren
387f590d9c [gitea] week 2025-03 cherry pick (gitea/main -> forgejo) (#6539)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6539
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2025-01-17 01:58:00 +00:00
Jaime merino
9f842f0dec Add search action jobs for API routes, repo, org and global level (#6300)
This PR wants to improve information of the tasks waiting to be executed on a global, organization, user and repository leve.
The main motivation is explained here https://codeberg.org/forgejo/discussions/issues/241

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [x] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [ ] I do not want this change to show in the release notes.
- [x] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

<!--start release-notes-assistant-->

## Release notes
<!--URL:https://codeberg.org/forgejo/forgejo-->
- Features
  - [PR](https://codeberg.org/forgejo/forgejo/pulls/6300): <!--number 6300 --><!--line 0 --><!--description QWRkIHNlYXJjaCBhY3Rpb24gam9icyBmb3IgQVBJIHJvdXRlcywgcmVwbywgb3JnIGFuZCBnbG9iYWwgbGV2ZWw=-->Add search action jobs for API routes, repo, org and global level<!--description-->
<!--end release-notes-assistant-->

Co-authored-by: jaime merino <jaime.merino_mora@mail.schwarzª>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6300
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Jaime merino <cobak78@gmail.com>
Co-committed-by: Jaime merino <cobak78@gmail.com>
2025-01-14 11:17:42 +00:00
Earl Warren
9a608a034d feat: add a buffer writer to the logger, for internal use (#6551)
Identical to console, file or conn but writes to a buffer instead.

It is useful in two contexts:

- tests that need to assert the logs in a way that is simpler than
  LogChecker.
- capturing the logs of a given task to display in the web UI,
  return from the API, etc.

Since all logged events at a given level are written to the buffer by default, it is best used with WriterMode.Expression to only keep the log lines of interest.

## Checklist

The [contributor guide](https://forgejo.org/docs/next/contributor/) contains information that will be helpful to first time contributors. There also are a few [conditions for merging Pull Requests in Forgejo repositories](https://codeberg.org/forgejo/governance/src/branch/main/PullRequestsAgreement.md). You are also welcome to join the [Forgejo development chatroom](https://matrix.to/#/#forgejo-development:matrix.org).

### Tests

- I added test coverage for Go changes...
  - [x] in their respective `*_test.go` for unit tests.
  - [ ] in the `tests/integration` directory if it involves interactions with a live Forgejo server.
- I added test coverage for JavaScript changes...
  - [ ] in `web_src/js/*.test.js` if it can be unit tested.
  - [ ] in `tests/e2e/*.test.e2e.js` if it requires interactions with a live Forgejo server (see also the [developer guide for JavaScript testing](https://codeberg.org/forgejo/forgejo/src/branch/forgejo/tests/e2e/README.md#end-to-end-tests)).

### Documentation

- [ ] I created a pull request [to the documentation](https://codeberg.org/forgejo/docs) to explain to Forgejo users how to use this change.
- [x] I did not document these changes and I do not expect someone else to do it.

### Release notes

- [x] I do not want this change to show in the release notes.
- [ ] I want the title to show in the release notes with a link to this pull request.
- [ ] I want the content of the `release-notes/<pull request number>.md` to be be used for the release notes instead of the title.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6551
Reviewed-by: Antonin Delpeuch <wetneb@noreply.codeberg.org>
Co-authored-by: Earl Warren <contact@earl-warren.org>
Co-committed-by: Earl Warren <contact@earl-warren.org>
2025-01-13 13:40:24 +00:00
yp05327
f809052193
Support the new exit code for git remote subcommands for git version >=2.30.0 (#33129)
Fix #32889

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 0d7d2ed39d0c0435cdc6403ee7764850154dca5a)

Conflicts:
	modules/git/remote.go
  trivial context conflict
2025-01-12 08:52:51 +01:00
Earl Warren
4261301dfb [gitea] week 2025-02 cherry pick (gitea/main -> forgejo) (#6471)
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6471
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2025-01-07 06:17:49 +00:00
Renovate Bot
4b0d11976f Update module github.com/alecthomas/chroma/v2 to v2.15.0 (forgejo) (#6477)
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [github.com/alecthomas/chroma/v2](https://github.com/alecthomas/chroma) | require | minor | `v2.14.0` -> `v2.15.0` |

---

### Release Notes

<details>
<summary>alecthomas/chroma (github.com/alecthomas/chroma/v2)</summary>

### [`v2.15.0`](https://github.com/alecthomas/chroma/releases/tag/v2.15.0)

[Compare Source](https://github.com/alecthomas/chroma/compare/v2.14.0...v2.15.0)

#### What's Changed

-   AQL: Add builtin functions introduced in v3.12 by [@&#8203;Simran-B](https://github.com/Simran-B) in https://github.com/alecthomas/chroma/pull/968
-   chore(styles): add evergarden inspired style by [@&#8203;comfysage](https://github.com/comfysage) in https://github.com/alecthomas/chroma/pull/970
-   chore(deps): update dependency svu to v2 by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/971
-   chore(deps): update dependency watchexec to v2 by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/962
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/955
-   styles: Fix Gleam alias by [@&#8203;jmooring](https://github.com/jmooring) in https://github.com/alecthomas/chroma/pull/973
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/974
-   chore(deps): update dependency python3 to v3.12.3 by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/976
-   added the nordic theme via chroma/styles/nordic.xml by [@&#8203;avih7531](https://github.com/avih7531) in https://github.com/alecthomas/chroma/pull/977
-   Update the Materialize lexer by [@&#8203;arusahni](https://github.com/arusahni) in https://github.com/alecthomas/chroma/pull/978
-   feat(lexers/hare): add done keyword by [@&#8203;wackbyte](https://github.com/wackbyte) in https://github.com/alecthomas/chroma/pull/979
-   pygments2chroma: escape regex.words by [@&#8203;oliverpool](https://github.com/oliverpool) in https://github.com/alecthomas/chroma/pull/982
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/981
-   Add JSONata Lexer by [@&#8203;DevDimov](https://github.com/DevDimov) in https://github.com/alecthomas/chroma/pull/983
-   Go lexer: single line comment without consuming endline, disable EnsureNL by [@&#8203;msorc](https://github.com/msorc) in https://github.com/alecthomas/chroma/pull/984
-   Update the Materialize lexer by [@&#8203;arusahni](https://github.com/arusahni) in https://github.com/alecthomas/chroma/pull/987
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/985
-   Add Gleam to README by [@&#8203;Nicd](https://github.com/Nicd) in https://github.com/alecthomas/chroma/pull/990
-   Port Minecraft lexers from Pygments by [@&#8203;kofuk](https://github.com/kofuk) in https://github.com/alecthomas/chroma/pull/992
-   Don't output extra whitespace in YAML multiline by [@&#8203;Gusted](https://github.com/Gusted) in https://github.com/alecthomas/chroma/pull/993
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/991
-   add beef syntax and tests by [@&#8203;Booklordofthedings](https://github.com/Booklordofthedings) in https://github.com/alecthomas/chroma/pull/995
-   Update GitHub light color palette by [@&#8203;konradreiche](https://github.com/konradreiche) in https://github.com/alecthomas/chroma/pull/998
-   chore(deps): update module github.com/alecthomas/kong to v1 by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/999
-   Update the Materialize lexer by [@&#8203;arusahni](https://github.com/arusahni) in https://github.com/alecthomas/chroma/pull/1001
-   Update TypeScript lexer to allow nested generics by [@&#8203;fredrare](https://github.com/fredrare) in https://github.com/alecthomas/chroma/pull/1002
-   Pager friendly terminal formatting by [@&#8203;walles](https://github.com/walles) in https://github.com/alecthomas/chroma/pull/1006
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/997
-   Add Typst Lexer by [@&#8203;oliverpool](https://github.com/oliverpool) in https://github.com/alecthomas/chroma/pull/1007
-   Add Jsonnet Lexer by [@&#8203;jolheiser](https://github.com/jolheiser) in https://github.com/alecthomas/chroma/pull/1011
-   fix: add underscore parsing in numbers for haskell by [@&#8203;Gusted](https://github.com/Gusted) in https://github.com/alecthomas/chroma/pull/1020
-   Add CSV lexer by [@&#8203;walles](https://github.com/walles) in https://github.com/alecthomas/chroma/pull/1005
-   fix(typescript): highlight string literal type parameters by [@&#8203;SKalt](https://github.com/SKalt) in https://github.com/alecthomas/chroma/pull/1010
-   add any as a builtin type for go by [@&#8203;quartercastle](https://github.com/quartercastle) in https://github.com/alecthomas/chroma/pull/1021
-   chore(deps): update all non-major dependencies by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/1013
-   Remove whitespace tokenizing rule in markdown lexer by [@&#8203;cloudchamb3r](https://github.com/cloudchamb3r) in https://github.com/alecthomas/chroma/pull/1008
-   feat(JSON): support `.jsonc` extension by [@&#8203;CarterLi](https://github.com/CarterLi) in https://github.com/alecthomas/chroma/pull/1022
-   Add Eclipse ATL language (https://eclipse.dev/atl/) by [@&#8203;dwagelaar](https://github.com/dwagelaar) in https://github.com/alecthomas/chroma/pull/1024
-   Import NSIS Lexer from Pygments by [@&#8203;JakobDev](https://github.com/JakobDev) in https://github.com/alecthomas/chroma/pull/1026
-   chore(deps): update module github.com/alecthomas/kong to v1.5.1 by [@&#8203;renovate](https://github.com/renovate) in https://github.com/alecthomas/chroma/pull/1025
-   fix(nix): nix lexor missing '=' operator by [@&#8203;FlyingStitchman](https://github.com/FlyingStitchman) in https://github.com/alecthomas/chroma/pull/1031
-   Add WebVTT lexer ([#&#8203;707](https://github.com/alecthomas/chroma/issues/707)) by [@&#8203;dschuessler](https://github.com/dschuessler) in https://github.com/alecthomas/chroma/pull/1032

#### New Contributors

-   [@&#8203;comfysage](https://github.com/comfysage) made their first contribution in https://github.com/alecthomas/chroma/pull/970
-   [@&#8203;avih7531](https://github.com/avih7531) made their first contribution in https://github.com/alecthomas/chroma/pull/977
-   [@&#8203;wackbyte](https://github.com/wackbyte) made their first contribution in https://github.com/alecthomas/chroma/pull/979
-   [@&#8203;oliverpool](https://github.com/oliverpool) made their first contribution in https://github.com/alecthomas/chroma/pull/982
-   [@&#8203;DevDimov](https://github.com/DevDimov) made their first contribution in https://github.com/alecthomas/chroma/pull/983
-   [@&#8203;msorc](https://github.com/msorc) made their first contribution in https://github.com/alecthomas/chroma/pull/984
-   [@&#8203;Nicd](https://github.com/Nicd) made their first contribution in https://github.com/alecthomas/chroma/pull/990
-   [@&#8203;Booklordofthedings](https://github.com/Booklordofthedings) made their first contribution in https://github.com/alecthomas/chroma/pull/995
-   [@&#8203;konradreiche](https://github.com/konradreiche) made their first contribution in https://github.com/alecthomas/chroma/pull/998
-   [@&#8203;fredrare](https://github.com/fredrare) made their first contribution in https://github.com/alecthomas/chroma/pull/1002
-   [@&#8203;SKalt](https://github.com/SKalt) made their first contribution in https://github.com/alecthomas/chroma/pull/1010
-   [@&#8203;quartercastle](https://github.com/quartercastle) made their first contribution in https://github.com/alecthomas/chroma/pull/1021
-   [@&#8203;cloudchamb3r](https://github.com/cloudchamb3r) made their first contribution in https://github.com/alecthomas/chroma/pull/1008
-   [@&#8203;CarterLi](https://github.com/CarterLi) made their first contribution in https://github.com/alecthomas/chroma/pull/1022
-   [@&#8203;dwagelaar](https://github.com/dwagelaar) made their first contribution in https://github.com/alecthomas/chroma/pull/1024
-   [@&#8203;FlyingStitchman](https://github.com/FlyingStitchman) made their first contribution in https://github.com/alecthomas/chroma/pull/1031
-   [@&#8203;dschuessler](https://github.com/dschuessler) made their first contribution in https://github.com/alecthomas/chroma/pull/1032

**Full Changelog**: https://github.com/alecthomas/chroma/compare/v2.14.0...v2.15.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "* 0-3 * * *" (UTC), Automerge - "* 0-3 * * *" (UTC).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS45MC4wIiwidXBkYXRlZEluVmVyIjoiMzkuOTAuMCIsInRhcmdldEJyYW5jaCI6ImZvcmdlam8iLCJsYWJlbHMiOlsiZGVwZW5kZW5jeS11cGdyYWRlIiwidGVzdC9ub3QtbmVlZGVkIl19-->

Co-authored-by: Gusted <postmaster@gusted.xyz>
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6477
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
Co-committed-by: Renovate Bot <forgejo-renovate-action@forgejo.org>
2025-01-06 04:11:25 +00:00
wxiaoguang
e507fa30df
Refactor env var related code (#33075)
And add more comments

(cherry picked from commit 4f386e2c5e39b860424faf4cbc02c16f641f956e)

Conflicts:
	cmd/main_test.go
	tests/integration/integration_test.go
  trivial context conflicts
2025-01-05 13:46:19 +00:00
JonRB
6208d5f5c2
unset XDG_HOME_CONFIG as gitea manages configuration locations (#33067)
unset XDG_CONFIG_HOME early to enable gitea to manage git configuration.
simple error checking to satisfy the linting. Closes #33039

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 233b7959e0518c47ef83c6a80c617546983433eb)
2025-01-05 13:46:19 +00:00
cassio zareck
9b2f38261b
Fix settings not being loaded at CLI (#26402)
Closes #25898
The problem was that the default settings weren't being loaded

---------

Signed-off-by: cassiozareck <cassiomilczareck@gmail.com>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 1e2c8eb494ff5b8378653db5fed876d824ebca6f)

Conflicts:
	modules/setting/indexer.go
  trivial context conflict
2025-01-05 12:13:48 +00:00
Lunny Xiao
bc64b6f004
Use gitrepo.GetTreePathLatestCommit to get file lastest commit instead from latest commit cache (#32987)
The latest commit cache is currently used only for listing tree files.
However, a cold start may take longer than directly invoking the Git
command. This PR addresses the issue of slow response times when
accessing raw files, improving performance in such scenarios.

```log
gitea.log:105521:2024/12/23 08:22:18 ...eb/routing/logger.go:68:func1() [W] router: slow      GET /xxxx/xxxxxx/raw/commit/xxxxxxxxxxxxxxxxxxxxxxxxxxx/.editorconfig for 172.18.0.5:53252, elapsed 3526.8ms @ repo/download.go:117(repo.SingleDownload)
```

(cherry picked from commit f4ccbd38dca77b1515a08ddf927f4f20cf644d30)
2025-01-05 12:13:48 +00:00
Gusted
3f44b97b5f
feat: add limited execution tracing support
- For every process that is spawned (every new non-trivial goroutine
such as http requests, queues or tasks) start a [execution
tracer](https://pkg.go.dev/runtime/trace). This allows very precise
diagnosis of how each individual process over a time period.
- It's safe and [fast](https://go.dev/blog/execution-traces-2024#low-overhead-tracing) to
be run in production, hence no setting to disable this. There's only
noticable overhead when tracing is actually performed and not continuous.
- Proper tracing support would mean the codebase would be full of
`trace.WithRegion` and `trace.Log`, which feels premature for this patch
as there's no real-world usage yet to indicate which places would need
this the most. So far only Git commands and SQL queries receive somewhat
proper tracing support given that these are used throughout the codebase.
- Make git commands a new process type.
- Add tracing to diagnosis zip file.
2025-01-05 04:07:49 +01:00
Gusted
a2e0dd829c
chore: avoid trying to stream data
`profile.Parse` always call `io.ReadAll` so avoid the trouble and a
goroutine and do it ourselves.

Add some limited testing (testing the parsed stack is volatile and not
really feasible).
2025-01-05 04:07:49 +01:00
Angel Nunez Mencias
a2eb249766 feat: add files to compare (#6461)
Add the changed files between two commits to the response of the compare API, part of forgejo/forgejo#6460

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6461
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Co-authored-by: Angel Nunez Mencias <git@angelnu.com>
Co-committed-by: Angel Nunez Mencias <git@angelnu.com>
2025-01-05 02:32:46 +00:00
Otto
b01f3b9b05 Merge pull request 'feat: Add summary card for repos and releases' (#6269) from JakobDev/forgejo:repocard into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6269
Reviewed-by: Mathieu Fenniak <mfenniak@noreply.codeberg.org>
Reviewed-by: Otto <otto@codeberg.org>
2025-01-01 17:48:28 +00:00
JakobDev
bc2f640a95
Update 2024-12-30 17:47:34 +01:00
Earl Warren
8e3c066b27 Merge pull request 'chore(branding): strip metadata information from the footer' (#6403) from earl-warren/forgejo:wip-footer into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6403
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
2024-12-30 15:29:21 +00:00
Earl Warren
2c81893c76
chore(branding): strip metadata information from the footer
When the Forgejo version is displayed in the footer, the metadata
should not be displayed. It was once an indication that Forgejo
includes all of Gitea. But since the hard fork the codebase diverged
and this is no longer accurate.

The metadata is still displayed in the API, admin panels or headers
for the sake of backward compatibility.

Refs: https://codeberg.org/forgejo/discussions/issues/244
2024-12-29 22:40:13 +00:00
JakobDev
a82cd18d9a Merge branch 'forgejo' into repocard 2024-12-29 11:20:09 +00:00
JakobDev
b7d7431d05
Fix typos 2024-12-28 21:20:55 +01:00
katsu
0efd7130f0
fix trailing comma not matched in the case of alphanumeric issue (#32945)
Fix #32428.

Patch the regex to match `,`besides `.` `"` `'` `:` and space.

(cherry picked from commit fb75151fb14e866cab8d893c588f5673902b278b)
2024-12-28 19:00:07 +00:00
Gusted
967603abcc
feat: harden keying implementation
Harden the current checks in place, I doubt these will ever hit (you can
prove easily by reading the current source code this cannot happen) but
just in case a new Go version does something weird or something else
goes catastrophicly wrong, this should add an extra defense-in-depth
layer.

`n != aeadKeySize` will panic a nil error, don't think it's needed to
add more logic to this, a nil error is enough to indicate that that
condition failed (given the other condition is `err != nil`).

Also move constant integers to being `const`, this helps reducing the
amount of instructions being done for the extra check.
2024-12-25 00:10:18 +01:00
George Bartolomey
13ca6c14f1
feat: allow changing default branch update style
This commit allows chaning default branch update style through global
and repository settings. The setting affects "Update branch" button
in PR view (button shows when some commits are ahead of master branch).
When default update style is set to "rebase", dropdown button updates branch
by rebase by default. When update style is set to other value, dropdown button
updates branch by merge. Any of these actions may be selected using dropdown
in any case.

Signed-off-by: George Bartolomey <george@bh4.ru>
2024-12-23 18:55:25 +03:00
Shiny Nematoda
ee214cb886 feat: filepath filter for code search (#6143)
Added support for searching content in a specific directory or file.

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6143
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
Reviewed-by: 0ko <0ko@noreply.codeberg.org>
Co-authored-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
Co-committed-by: Shiny Nematoda <snematoda.751k2@aleeas.com>
2024-12-22 12:24:29 +00:00
Gusted
1e7b922e44 Merge pull request 'fix: keep commit count limit in file history pagination static and not increase with every page' (#6337) from emilylange/fix-file-history-commit-pagination-limit into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6337
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-22 00:02:38 +00:00
emilylange
cd2c1361c5
fix: keep commit count limit in file history pagination static and not increase with every page
This fixes a regression introduced by 58a4407acb
from 2022 which reintroduced passing `--skip` to `git rev-list` in favor
of the custom skipping reader based on `io.CopyN` from 59d1cc49f1
and then forgetting to also revert the
`--max-count=CommitsRangeSize*Page` math.

Before this commit:

~~~bash
# curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=1" | jq length
50

# curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=2" | jq length
100

# curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=10" | jq length
500
~~~

With this commit applied:

~~~bash
# curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=1" | jq length
50

# curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=2" | jq length
50

# curl -s "http://localhost:3000/api/v1/repos/forgejo/forgejo/commits?path=templates&page=10" | jq length
50
~~~
2024-12-21 23:46:29 +01:00
Julian Schlarb
b15352ceb0 fix: maven fallback to parent groupId 2024-12-21 11:48:09 +01:00
Gusted
2102163f2f Merge pull request 'chore: avoid using gock' (#6311) from gusted/forgejo-gock into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6311
Reviewed-by: Michael Kriese <michael.kriese@gmx.de>
2024-12-20 21:15:11 +00:00
JakobDev
265174bd5e Merge branch 'forgejo' into repocard 2024-12-19 15:11:12 +00:00
Earl Warren
d07c5cf69c
fix: actions move to data.forgejo.org
code.forgejo.org is meant for development, the actions need to be
highly available and can be read-only. This is what data.forgejo.org
will provide.
2024-12-19 10:55:05 +01:00
Earl Warren
380e266440 Merge pull request '[gitea] week 2024-51 cherry pick (gitea/main -> forgejo)' (#6271) from earl-warren/wcp/2024-51 into forgejo
Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/6271
Reviewed-by: Gusted <gusted@noreply.codeberg.org>
2024-12-19 07:08:01 +00:00
JakobDev
df570a1d71 Merge branch 'forgejo' into repocard 2024-12-18 19:27:24 +00:00
Gusted
c26c60ccd1
chore: avoid using gock
- Avoid using gock to do HTTP mocking, this is fairly simply to do
ourselves and avoids a dependency, this commit does right that.
2024-12-18 06:40:02 +01:00
Gusted
61e21d7ded
chore: Make Forgejo build with go1.24
- [Go 1.24](https://groups.google.com/g/golang-announce/c/vYMfuq_XO6w)
is currently out for rc1.
- Using it to test unit tests and integration testing it failed horribly
with strange panics and errors, it is caused by
ca63101df4
and Forgejo trying to access the wrong internal data structures that
have been changed in Go 1.24.
- Use the new data structure for Go 1.24 and above.
2024-12-17 16:12:22 +01:00
Earl Warren
9283b03f3e
Add User-Agent for gitea's self-implemented lfs client. (branding) 2024-12-17 06:18:24 +01:00
hiifong
68278c796d
In some lfs server implementations, they require the ref attribute. (#32838)
Fix: #32611

In some lfs server implementations, they require the ref attribute.

---------

Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
(cherry picked from commit 7616aeb2ea2a02c15480dcd4a232e98081569690)
2024-12-15 10:14:21 +01:00