steps-git-clone icon indicating copy to clipboard operation
steps-git-clone copied to clipboard

Git lfs files are only pointers when merge_pr: true

Open magnusvs opened this issue 5 months ago • 0 comments

Troubleshooting

  • [x] I've searched discuss.bitrise.io for possible solutions.
  • Which version of the step is effected? 8.2.2
  • Is the issue reproducible with the latest version? YES
  • Does the issue happen sporadically, or every time? EVERY TIME
  • Is the issue reproducible locally by following our local debug guide? YES

Useful information

Issue description

Hi,

When doing a git clone with the option merge_pr: true this step seems to do a git diff and apply that does not support git lfs files. They are only pointers and not full files when the subsequent steps are run (the run fails because of this)

The issue seems to be the way this step clones the repo only when merge_pr: true and Bitrise is triggered from a PR with a target branch.

It works fine if there's no target branch, or disabling merge_pr.

It's also possible to reproduce a similar state with git locally (if you have branch with a new lfs file):

  • git diff branch-a branch-b >diff.txt
  • git apply diff.txt --index

You should now see the issue by running git lfs ls-files and the missing file will be listed as a pointer and not a full file: 070f11bade - somefile.png It should instead be 070f11bade * somefile.png

At this point I haven't found a way to make lfs actually pull the file. Maybe there is one and this is easily solved. Otherwise what's the reasoning for doing this sort of manual diff and apply? Could a merge be used instead to solve the lfs issues?

Bitrise info

 
  

Steps to reproduce

(Possibly you have to use Bitbucket, since I think it doesn't provide a "merged state" for a pr)

  1. Checkout a new branch branch-b
  2. Make sure lfs is set up for example for all *.png files, then add a .png file and commit+push
  3. Create a PR from branch-b that triggers bitrise to use git-clone with a pull_request_merge_branch
  4. Make sure there's a step that tries to use/read the added .png file. It should fail because it hasn't been fetched from lfs.

magnusvs avatar Sep 05 '24 17:09 magnusvs