0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-22 15:23:14 -05:00
forgejo/services
Jason Song 2302cf63c8
Distinguish LFS object errors to ignore missing objects during migration (#31702)
Fix #31137.

Replace #31623 #31697.

When migrating LFS objects, if there's any object that failed (like some
objects are losted, which is not really critical), Gitea will stop
migrating LFS immediately but treat the migration as successful.

This PR checks the error according to the [LFS api
doc](https://github.com/git-lfs/git-lfs/blob/main/docs/api/batch.md#successful-responses).

> LFS object error codes should match HTTP status codes where possible:
>
> - 404 - The object does not exist on the server.
> - 409 - The specified hash algorithm disagrees with the server's
acceptable options.
> - 410 - The object was removed by the owner.
> - 422 - Validation error.

If the error is `404`, it's safe to ignore it and continue migration.
Otherwise, stop the migration and mark it as failed to ensure data
integrity of LFS objects.

And maybe we should also ignore others errors (maybe `410`? I'm not sure
what's the difference between "does not exist" and "removed by the
owner".), we can add it later when some users report that they have
failed to migrate LFS because of an error which should be ignored.

(cherry picked from commit 09b56fc0690317891829906d45c1d645794c63d5)
2024-08-04 18:24:10 +02:00
..
actions Move registerActionsCleanup to initActionsTasks (#31721) 2024-08-04 10:14:34 +02:00
agit fix(hook): ignore unknown push options instead of failing 2024-07-02 21:39:01 +02:00
asymkey Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
attachment Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
auth Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
automerge Fix automerge will not work because of some events haven't been triggered (#30780) 2024-05-26 19:01:36 +02:00
context feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
contexttest Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
convert feat(quota): Humble beginnings of a quota engine 2024-08-02 11:10:34 +02:00
cron Move registerActionsCleanup to initActionsTasks (#31721) 2024-08-04 10:14:34 +02:00
doctor Replace Gitea with Forgejo 2024-07-24 14:17:23 +00:00
externalaccount allow synchronizing user status from OAuth2 login providers (#31572) 2024-07-22 15:44:13 +02:00
f3 Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
federation feat(federated-star) star repositories via ActivityPub (#1680) 2024-06-06 08:58:11 +02:00
feed Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
forgejo Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
forms Fix: Allow org team names of length 255 in create team form (#31564) 2024-07-14 11:16:34 +02:00
gitdiff Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
indexer Update issue indexer after merging a PR (#30715) 2024-05-12 20:03:10 +02:00
issue Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
lfs feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
mailer Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
markup Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
migrations Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
mirror feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
notify Clean up log messages (#30313) 2024-04-15 20:01:35 +02:00
org Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
packages Arch packages implementation (#4785) 2024-08-04 06:16:29 +00:00
pull fix: use url.JoinPath to join url parts 2024-07-31 14:45:37 +02:00
release Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
remote Enable unparam linter (#31277) 2024-06-16 13:42:58 +02:00
repository Distinguish LFS object errors to ignore missing objects during migration (#31702) 2024-08-04 18:24:10 +02:00
secrets
task feat(quota): Quota enforcement 2024-08-02 11:10:34 +02:00
uinotification
user Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
webhook Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
wiki Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00