1
0
mirror of https://github.com/go-gitea/gitea.git synced 2024-11-04 08:17:24 -05:00
gitea/services/repository
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
..
archiver Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
commitstatus Fix automerge will not work because of some events haven't been triggered (#30780) 2024-05-21 23:23:22 +08:00
files Refactor names (#31405) 2024-06-19 06:32:45 +08:00
adopt_test.go Add a simple test for AdoptRepository (#31391) 2024-06-17 01:18:35 +00:00
adopt.go Fix incorrect default branch when adopt a repository (#30912) 2024-05-09 08:44:26 +00:00
avatar_test.go
avatar.go
branch.go Fix a branch divergence cache bug (#31659) 2024-07-19 17:52:49 +02:00
cache.go
check.go
collaboration_test.go Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
collaboration.go Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
commit.go Move context from modules to services (#29440) 2024-02-27 08:12:22 +01:00
contributors_graph_test.go Refactor cache and disable go-chi cache (#30417) 2024-04-13 08:38:44 +00:00
contributors_graph.go Enable more revive linter rules (#30608) 2024-04-22 11:48:42 +00:00
create_test.go
create.go Move get/set default branch from git package to gitrepo package to hide repopath (#29126) 2024-03-08 15:30:10 +08:00
delete_test.go
delete.go Clarify permission "HasAccess" behavior (#30585) 2024-04-20 03:15:04 +00:00
fork_test.go
fork.go Add user blocking (#29028) 2024-03-04 08:16:03 +00:00
generate_test.go Move generate from module to service (#29465) 2024-02-28 14:40:36 +01:00
generate.go Add YEAR, MONTH, MONTH_ENGLISH, DAY variables for template repos (#31584) 2024-07-09 18:05:12 +00:00
hooks.go
init.go Move generate from module to service (#29465) 2024-02-28 14:40:36 +01:00
lfs_test.go
lfs.go
main_test.go
migrate.go Distinguish LFS object errors to ignore missing objects during migration (#31702) 2024-07-31 10:29:48 +00:00
push.go Fix a branch divergence cache bug (#31659) 2024-07-19 17:52:49 +02:00
repository_test.go
repository.go Fix "force private" logic (#31012) 2024-05-20 00:56:45 +00:00
review_test.go
review.go
setting.go
template.go Move generate from module to service (#29465) 2024-02-28 14:40:36 +01:00
transfer_test.go Clarify permission "HasAccess" behavior (#30585) 2024-04-20 03:15:04 +00:00
transfer.go Add lint-go-gopls (#30729) 2024-06-05 09:22:38 +08:00