-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Closed
Description
Problem Description
When some local LFS objects in .git/lfs/objects/ are missing (see below for such situations) then the git push will report that missing objects, but will continue the push operation:
$ git push -u origin master
Locking support detected on remote "origin". Consider enabling it with:
$ git config lfs.https://git-id-test0.conti.de/cds-sqe-lfs/repo_missing_oid.git/info/lfs.locksverify true
LFS upload missing objects: (0/2), 0 B | 0 B/s
(missing) LFS_File.xxx (06b936c7439c774eca9c8ae27b39311c6b9c9508cd4413f53ff52f4320913b2e)
Uploading LFS objects: 0% (0/2), 0 B | 0 B/s, done
Counting objects: 7, done.
Delta compression using up to 8 threads.
Compressing objects: 100% (6/6), done.
Writing objects: 100% (7/7), 786 bytes | 393.00 KiB/s, done.
Total 7 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To git-id-test0.conti.de:cds-sqe-lfs/repo_missing_oid.git
* [new branch] master -> master
Branch 'master' set up to track remote branch 'master' from 'origin'.
The git repository now exists on GitHub, but the referenced LFS file has not been uploaded => data inconsitency
Possible Situations where local LFS objects are missing
- User has deleted that object 😨
- Fetch commits containing LFS objects from remote A and push these commits to remote B
Here is a Perl script which reproduces this use case (you need to adapt some variable at the beginning):
ReproduceMissingOID.pl.txt
And here the output of that script:
ReproduceMissingOID.log - Fetch commits containing LFS objects from remote A, cherry-pick some of that commits and push these new cherry-picked commits to remote B
This use case has led to ca. 200 missing LFS objects in one case 💥. Fortunately these objects were already on GitHub from remote A.
Requested Change
The Git LFS pre-push hook shall abort the git push operation if some Git LFS objects are missing to avoid that commits can be uploaded to GitHub without the corresponding Git LFS objects.
Workaround
For the fetch use cases (see 2. and 3. above) after the normal fetch call:
git rev-list HEAD..FETCH_HEAD | xargs git lfs fetch <remote A>
This should download all referenced LFS objects of the fetched commits (if the fetch does not include multiple branches).
Environment
$ git lfs env
git-lfs/2.4.2 (GitHub; windows amd64; go 1.8.3; git 6f4b2e98)
git version 2.17.1.windows.2
Endpoint=https://git-id-test0.conti.de/cds-sqe-lfs/repo_missing_oid.git/info/lfs (auth=none)
SSH=git@git-id-test0.conti.de:cds-sqe-lfs/repo_missing_oid.git
LocalWorkingDir=D:\casdev\_test\Missing_LFS_Objects\missing_oid_script\repo_missing_oid
LocalGitDir=D:\casdev\_test\Missing_LFS_Objects\missing_oid_script\repo_missing_oid\.git
LocalGitStorageDir=D:\casdev\_test\Missing_LFS_Objects\missing_oid_script\repo_missing_oid\.git
LocalMediaDir=D:\casdev\_test\Missing_LFS_Objects\missing_oid_script\repo_missing_oid\.git\lfs\objects
LocalReferenceDir=
TempDir=D:\casdev\_test\Missing_LFS_Objects\missing_oid_script\repo_missing_oid\.git\lfs\tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=D:\casdev\_test\Missing_LFS_Objects\missing_oid_script\repo_missing_oid\.git\lfs
AccessDownload=none
AccessUpload=none
DownloadTransfers=basic
UploadTransfers=basic
GIT_EXEC_PATH=C:/Program Files/Git/mingw64/libexec/git-core
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels