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

  1. Enable LFS on a project and commit .gitattributes with assets/** filter=lfs diff=lfs merge=lfs -text to main.
  2. POST /api/v4/projects/:id/repository/commits with branch: feature-x, start_branch: main, and a create action for assets/image.bin.
  3. GET /api/v4/projects/:id/repository/files/assets%2Fimage.bin?ref=feature-x — content should be an LFS pointer (~130 bytes starting version https://git-lfs.github.com/spec/v1), not the raw file.

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist.

Merge request reports

Loading
Loading