1
0
Fork 0
forgejo/services/repository
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
..
archiver Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
commitstatus Fix automerge will not work because of some events haven't been triggered (#30780) 2024-05-26 19:01:36 +02:00
files Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
adopt.go Fix incorrect default branch when adopt a repository (#30912) 2024-05-12 20:03:10 +02:00
adopt_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
avatar.go
avatar_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
branch.go Fix push multiple branches error with tests (#31151) 2024-06-02 20:39:42 +02:00
cache.go
check.go Update tool dependencies (#29030) 2024-02-02 19:11:39 -05:00
collaboration.go
collaboration_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
commit.go Move context from modules to services (#29440) 2024-03-06 12:10:43 +08:00
contributors_graph.go [ENHANCEMENT] Improve caching of contributor stats 2024-07-06 21:23:46 +02:00
contributors_graph_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
create.go Move get/set default branch from git package to gitrepo package to hide repopath (#29126) 2024-03-11 23:36:59 +07:00
create_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
delete.go mysql: use inner join for hook_task deletion 2024-05-24 10:31:41 +02:00
fork.go Allow admins to fork repos even when creation limits are exhausted (#3277) 2024-04-17 05:52:02 +00:00
fork_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
generate.go Add YEAR, MONTH, MONTH_ENGLISH, DAY variables for template repos (#31584) 2024-07-14 11:14:11 +02:00
generate_test.go Move generate from module to service (#29465) 2024-03-06 12:10:44 +08:00
hooks.go
init.go Move generate from module to service (#29465) 2024-03-06 12:10:44 +08:00
lfs.go Refactor LFS GC functions 2024-04-05 16:49:15 +02:00
lfs_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
main_test.go
migrate.go Distinguish LFS object errors to ignore missing objects during migration (#31702) 2024-08-04 18:24:10 +02:00
push.go Do not update PRs based on events that happened before they existed 2024-04-11 11:16:23 +02:00
repository.go Merge branch 'forgejo' into forgejo-federated-pr5 2024-05-29 18:26:16 +02:00
repository_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
review.go
review_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00
setting.go Fix an actions schedule bug (#28942) 2024-03-25 16:27:32 +01:00
star.go feat(federated-star) star repositories via ActivityPub (#1680) 2024-06-06 08:58:11 +02:00
template.go Move generate from module to service (#29465) 2024-03-06 12:10:44 +08:00
transfer.go Add lint-go-gopls (#30729) 2024-06-09 11:13:39 +02:00
transfer_test.go Add testifylint to lint checks (#4535) 2024-07-30 19:41:10 +00:00