File upload UI obeys LFS filter
What
Creates an LFS pointer when gitattributes determines a file being uploaded should be handled through LFS.
Why
Not doing so results in the repo being in an invalid state. Git will transform the files during checkout, which can break scripts that expect a clean working tree after checkout.
LFS filter description
Usually git handles the transformation on checkout/commit with by calling LFS's filters, as described at https://github.com/git-lfs/git-lfs/blob/master/docs/spec.md#intercepting-git. Git itself processes the .gitattributes
files and uses that to decide when to call out to LFS which transforms files to/from LFS pointers.
Now Gitlab needs to learn how to mimic that and the MR does this by calling repository.attributes_at
from FileModificationHandler#lfs?
, passing in the file path and checking for the filter=lfs
attribute.
Are there points in the code the reviewer needs to double check?
Should this cover multi-file upload and renames?
Reminder to self: check what happens when a file rename through the UI changes if it matches the LFS filter. Also what if multi-file editor also changes .gitattributes? Files::CreateService, Files::UpdateService, Files::DeleteService, Commits::RevertService, Commits::CherryPickService, Files::CreateDirService
Multi file upload split to https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/16718 and issue created for rename (https://gitlab.com/gitlab-org/gitlab-ce/issues/42288)
Acceptance criteria
-
Changelog entry added, if necessary -
Documentation created/updated -
API support added -
Tests added for this feature/bug - Review
-
Has been reviewed by Backend
-