fix(lfs): Use full OID in relative path#36611
Draft
fwag wants to merge 2 commits intogo-gitea:mainfrom
Draft
Conversation
The `RelativePath` function was truncating the LFS OID when constructing the path. This caused incompatibility with the `git-lfs` standard, which expects the full, untruncated OID. This commit aligns Gitea's LFS implementation with the `git-lfs` standard by using the full OID in the file path. The tests have been updated to reflect this correction.
Author
|
@lunny, is there a reason why you used the truncated version of the OID? How can a migration script be created to convert existing LFS objects? |
The LFS object path generation was previously incorrect, using a truncated OID. This caused incompatibility with standard `git-lfs` tools like `git lfs fsck`. This commit corrects the path generation to use the full OID. To avoid breaking existing Gitea instances, read operations (`Get`, `Exists`, `Verify`) are now backward-compatible. They will check for LFS objects at the new path first, and fall back to the old path if the object is not found. New objects are always written to the new path. Additionally, a new doctor command `lfs-migrate-object-paths` is introduced. This allows administrators to migrate existing LFS objects from the old, incorrect path structure to the new, correct one.
Member
|
I don't think |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
RelativePathfunction was truncating the LFS OID when constructing the path. This caused incompatibility with thegit-lfsstandard, which expects the full, untruncated OID.This issue could prevent server-side hooks, such as
git lfs fsck, from functioning correctly.This commit aligns Gitea's LFS implementation with the
git-lfsstandard by using the full OID in the file path. The tests have been updated to reflect this correction.