Store git object data when push fails due to missing LFS objects
There are situations where it may be possible to push git objects but not LFS objects. This could be caused by connectivity issues (bandwidth) or configuration problems with git-lfs
. Rather than rejecting the entire push, it would be nice if the git object data was retained, so that I have a backup if my computer fails.
Proposal
Store refs for failed pushes and allow them to be accessed for data recovery, if my computer fails
Why
Allows people to save their work even if the push has been rejected for some reason
@haochenxie suggested something like this as an alternative to allowing LFS checks to be bypassed:
Regarding the checkbox "Do we need a way to bypass this if
git lfs push --all
fails to work?" under the Todo section, I'd like to add some input.If we allow bypassing the check, data loss might occur, and it will cause headaches for other users of the same repository because they might not be able to pull the newest commit. But it is also annoying that one cannot save the work to a repository hosted on a Gitlab instance only because they cannot get LFS works properly. So I'd like to suggest instead of refusing the push and discarding new objects (and refs) when some LFS objects are missing, to rather save those objects and also save the refs UNDER A SPECIAL PREFIX, e.g. if a push to
heads/master
has an LFS object missing, the server rejects the update toheads/master
but save the objects and record the new commit under for examplelfs-inconsistent/<username>/heads/master
. If we take this approach, a proper UI might be necessary for this category of special refs but I think it is still an option to be considered.
Perhaps we should create a new issue for this? It would interfere with the approach taken in this MR to detect new blobs but we could work around that by excluding refs under
lfs-inconsistent/*
.Edit: If this was implemented it wouldn't necessarily be limited to LFS as it could be a more general recovery area for failed pushes, but would need care that pushes which failed security checks etc were still not stored