1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-07-18 17:19:41 +02:00
forgejo/services
Gusted 772bb20875 feat: improve checking if diffs differ (#8451)
This change is very similar to what was done in forgejo/forgejo#7727. When a PR is updated, `checkIfPRContentChanged` is called to check if the diff changed - this is done on a temporary repository. This change improves this checking by doing this operation on the bare repository. The change is split into several commits.

The following changes were made (in this exact order)

1. Update the `getTestPatchCtx` function that was introduced in forgejo/forgejo#7727 so it can be used outside the context of conflict checking. This is a simple change by making the caller determine if it can use a bare repository or not.

2. Do a small refactor of `ValidatePullRequest` to avoid indentation hell in this function, this is purely a refactor but necessary to not blow my brain while working on this function.

3. The first enhancement, introduce `testPatchCtx` in `ValidatePullRequest` to get diverging commits via the bare repository.

4. The main enhancement, do a refactor to move the function to be part of the repository struct and do a rename as this fits as a general purpose function. This refactoring includes it no longer being specific to a temporary repository and works on a bare repository.

5. Add extensive units tests, integration tests are added in forgejo/forgejo#8450 it checks that both calls to `CheckIfDiffDiffers` work. Because it also fixes a bug I sent it as a different PR.

6. Extend the integration test to check for diffs with commits from different repositories, to demonstrate that `getTestPatchCtx` works (specifically the `env` variable).

Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8451
Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org>
Co-authored-by: Gusted <postmaster@gusted.xyz>
Co-committed-by: Gusted <postmaster@gusted.xyz>
2025-07-16 18:19:27 +02:00
..
actions fix: disable Forgejo Actions email notifications on recovery (#8374) 2025-07-02 19:23:07 +02:00
agit fix: correctly mark reviews as stale for AGit PRs (#8450) 2025-07-09 07:38:00 +02:00
asymkey feat: consider WebAuthn & SSH for instance signing (#7693) 2025-04-29 10:34:07 +00:00
attachment fix: allow instance API URLs in release assets (#7644) 2025-06-09 10:01:59 +02:00
auth fix: ASCII equal fold for authorization header (#8391) 2025-07-09 23:01:03 +02:00
automerge fix: check PR reference on base repository (#8431) 2025-07-06 14:23:47 +02:00
context feat(ui): add repository description to og:image:alt (#8325) 2025-06-29 05:54:07 +02:00
contexttest Replace the 'relative-time' element scripting with custom, translatable rewrite (#6154) 2025-05-03 14:11:01 +00:00
convert feat: add configuration to only push mirror selected branches (#7823) 2025-07-12 00:39:35 +02:00
cron feat: auto cleanup of offline runners (#7803) 2025-06-08 00:13:37 +02:00
doctor chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
externalaccount chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
f3 Update module code.forgejo.org/f3/gof3/v3 to v3.11.0 (forgejo) (#8056) 2025-06-03 14:24:57 +02:00
federation Improved signature handling & instance actor (#8275) 2025-07-01 19:49:00 +02:00
feed Federated user activity following: Isolated model changes (#8078) 2025-06-21 12:02:58 +02:00
forgejo chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
forms feat: add configuration to only push mirror selected branches (#7823) 2025-07-12 00:39:35 +02:00
gitdiff fix: expanding exactly 20 lines between diff sections leaves visual artifact (#8519) 2025-07-16 08:04:38 +02:00
indexer chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
issue blob: use NewTruncatedReader for CodeOwners parsing 2025-06-20 20:43:10 +02:00
lfs chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
mailer fix(email): actions notification template confuses branch with PR (#8448) 2025-07-09 09:43:33 +02:00
markup chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
migrations [gitea] week 2025-22 cherry pick (gitea/main -> forgejo) (#8198) 2025-06-17 18:28:07 +02:00
mirror feat: add configuration to only push mirror selected branches (#7823) 2025-07-12 00:39:35 +02:00
moderation feat!: Abusive content reporting (#6977) 2025-05-18 08:05:16 +00:00
notify better comments and variable names for ActionRunNowDone (#7697) 2025-04-28 06:37:08 +00:00
org chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
packages several fixes of ALT Package registry (#8475) 2025-07-10 17:12:07 +02:00
pull feat: improve checking if diffs differ (#8451) 2025-07-16 18:19:27 +02:00
release chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
remote chore: tune down remote user promotion debug message shown as error (#7687) 2025-04-27 20:50:48 +00:00
repository git/commit: re-implement submodules file reader (#8438) 2025-07-15 00:20:00 +02:00
secrets chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
shared/automerge fix: do not ignore automerge while a PR is checking for conflicts (#8189) 2025-06-17 10:58:07 +02:00
task chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00
uinotification chore: branding import path (#7337) 2025-03-27 19:40:14 +00:00
user chore: QoL improvements to tests (#7917) 2025-05-21 15:45:56 +02:00
webhook [gitea] week 2025-19 cherry pick (gitea/main -> forgejo) (#7909) 2025-06-27 13:59:07 +02:00
wiki chore(cleanup): replaces unnecessary calls to formatting functions by non-formatting equivalents (#7994) 2025-05-29 17:34:29 +02:00