0
0
Fork 0
mirror of https://github.com/go-gitea/gitea synced 2024-12-24 19:54:41 +01:00
gitea/services
Jason Song 09b56fc069
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.
2024-07-31 10:29:48 +00:00
..
actions Move registerActionsCleanup to initActionsTasks (#31721) 2024-07-30 10:27:28 +08:00
agit
asymkey
attachment
auth allow synchronizing user status from OAuth2 login providers (#31572) 2024-07-16 20:33:16 +02:00
automerge
context Refactor names (#31405) 2024-06-19 06:32:45 +08:00
contexttest
convert add skip secondary authorization option for public oauth2 clients (#31454) 2024-07-19 14:28:30 -04:00
cron Move registerActionsCleanup to initActionsTasks (#31721) 2024-07-30 10:27:28 +08:00
doctor
externalaccount allow synchronizing user status from OAuth2 login providers (#31572) 2024-07-16 20:33:16 +02:00
feed
forms add skip secondary authorization option for public oauth2 clients (#31454) 2024-07-19 14:28:30 -04:00
gitdiff Update golangci-lint to v1.59.0 (#31221) 2024-06-03 07:04:35 +00:00
indexer
issue
lfs Refactor names (#31405) 2024-06-19 06:32:45 +08:00
mailer Add option to change mail from user display name (#31528) 2024-07-14 23:27:00 +02:00
markup
migrations Add lint-go-gopls (#30729) 2024-06-05 09:22:38 +08:00
mirror
notify
org
packages
pull Add permission check when creating PR (#31033) 2024-07-29 02:21:22 +00:00
release
repository Distinguish LFS object errors to ignore missing objects during migration (#31702) 2024-07-31 10:29:48 +00:00
secrets
task
uinotification
user
webhook Refactor webhook (#31587) 2024-07-10 11:37:16 +00:00
webtheme
wiki Refactor names (#31405) 2024-06-19 06:32:45 +08:00