Drop unused generic stub function for cloning files#6050
Merged
chrisd8088 merged 2 commits intogit-lfs:mainfrom May 22, 2025
Merged
Drop unused generic stub function for cloning files#6050chrisd8088 merged 2 commits intogit-lfs:mainfrom
chrisd8088 merged 2 commits intogit-lfs:mainfrom
Conversation
We added initial support for the deduplication of Git LFS object files between the Git working tree and our internal Git LFS storage directories in commit ea16fd5 of PR git-lfs#952, using the copy-on-write reflink functionality provided by the Linux Btrfs filesystem. Since we didn't implement equivalent capabilities for any other operating systems, we defined two versions of a new CloneFile() function in our "lfs" package, one for Linux, and one for all other types of systems. Later, in commit 1ef2d43 of PR git-lfs#1265, we moved the CopyWithCallback() function from our "lfs" package into our "tools" package, so it would be more widely available for use in our code base. In that same PR, for instance, the function was first used outside of the "lfs" package, in the download() method of what is now the basicDownloadAdapter in our "tq" package. Because the only caller of the CloneFile() function at the time was the CopyWithCallback() function, both versions of the function were copied to the "tools" package in commit 1ef2d43. However, while the Linux version was completely moved to the "tools" package by renaming the lfs/util_linux.go source file, the generic version was only copied to a new tools/util_generic.go source file, leaving the original lfs/util_generic.go in place. As the lfs/util_generic.go source file and the CloneFile() function it defines within the "lfs" package are no longer used, we can simply delete them now.
larsxschneider
approved these changes
May 22, 2025
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.
This PR removes the
CloneFile()stub function defined in ourlfspackage for non-Linux operating systems, as it is entirely unused.With this change, we remove the last use of a
cgoGo build constraint from our code base.Background
This
CloneFile()stub function is a remnant of the original support for Git LFS object file deduplication added in PR #952, at which time we only implemented this function for Linux systems with Btrfs filesystems, so we defined two versions of the newCloneFile()function in ourlfspackage, one for Linux, and one for all other types of systems.The only caller of the
CloneFile()function at the time was theCopyWithCallback()function. When that was moved into ourtoolspackage in PR #1265, the two implementations ofCloneFile()function were also copied to thetoolspackage at the same time, in commit 1ef2d43.However, while the Linux version was completely moved to the
toolspackage by renaming thelfs/util_linux.gosource file totools/util_linux.go, the generic version was only copied to a newtools/util_generic.gosource file, leaving the originallfs/util_generic.goin place.As the
lfs/util_generic.gosource file and theCloneFile()function it defines within thelfspackage are no longer used, we can simply delete them now.