Skip to content

WIP: Prevent git push when LFS objects are missing

James EJ requested to merge jej/fs-prevent-push-when-missing-objects into master

What

Finds new blobs during git-receive-pack and checks for any LFS pointers. If any of these are not in the lfs_objects table from a prior git lfs push then an error is raised to abort the push.

Why

Prevent repos getting to a broken state where they can' be cloned or have changes pulled.

Performance

  • This involves checking each new blob to see if it is an LFS pointer.
  • We're currently calling git rev-list manually instead of from gitaly or gitlab-shell
  • Fetching blob details is currently done with Rugged when we'd preferably use gitaly
  • For repositories which don't use LFS we'll want a way of bypassing this slow check

Todo

  • Do we need a way to bypass this if git lfs push --all fails to work?
  • Consider having some kind of limit on this for performance
  • Enquire about performance impact of current approach

Screenshot

pre-receive hook declined

Acceptance criteria

Related

Edited by James EJ

Merge request reports