Draft: Resolve "Files not tracked with LFS when uploaded through the web interface"
What does this MR do and why?
This MR fixes a bug where a create new file / file upload that matches the list of LFS files to track (e.g. a .pdf
file) isn't registered as an LFS file in the new branch. The core of the bug is that when creating a new file for a branch that doesn't yet exist, the logic is unable to determine which files should be LFS trackable and so assumes it shouldn't LFS tracked.
The solution here is to create the branch before we attempt to create the file. The new branch is created based off the branch the user was sitting within when they requested a new file to be created which will include the all important .gitattributes
file.
How to set up and validate locally
Referencing #326342 (closed):
- Set up a project with a repository with LFS enabled.
- Set up LFS tracking for at least one file, e.g.
git lfs track "*.pdf"
. - Commit and push so that
.gitattributes
is visible in themaster
branch in the web interface. - Invite a user as Developer.
- As this user, open the project (you see the
master
branch), click "+" and "Upload file". Leave default values and upload a file matching the LFS pattern specified in step (2), e.g.lfs-test.pdf
. - Check the newly (and automatically) created branch. The uploaded file is not tracked with LFS.
- Cross-check: create a branch manually and upload the file here the same way. It is tracked with LFS as expected.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Related to #326342 (closed)