Loading
Respect LFS rules when Commits API creates a branch
What does this MR do and why?
POST /projects/:id/repository/commits did not create Git LFS pointers for files matching .gitattributes when the same request created the target branch via start_branch or start_sha. Files::MultiService looked up .gitattributes on the not-yet-existing target branch, so the LFS filter never matched and files were committed verbatim.
Pass the start ref to Lfs::FileTransformer, as Files::CreateService and Files::UpdateService already do. Completes !139351 (merged) for the multi-action path, which also backs the GraphQL commitCreate mutation and the Web IDE.
References
Resolves #630124 (closed)
How to set up and validate locally
- Enable LFS on a project and commit
.gitattributeswithassets/** filter=lfs diff=lfs merge=lfs -texttomain. POST /api/v4/projects/:id/repository/commitswithbranch: feature-x,start_branch: main, and acreateaction forassets/image.bin.GET /api/v4/projects/:id/repository/files/assets%2Fimage.bin?ref=feature-x—contentshould be an LFS pointer (~130 bytes startingversion https://git-lfs.github.com/spec/v1), not the raw file.
MR acceptance checklist
Evaluate this MR against the MR acceptance checklist.