Remove file to LFS when renamed via the UI or created via commit API and matches LFS tracking
When renaming a file the path change can affect whether the file should be an LFS pointer.
For example, when renaming from
a.bin
toa.psd
if only one of them is tracked or when moving in/out of a subfolder which has it's own.gitattributes
file causing/preventing files being tracked in LFS.
We need to pay attention to this when renaming files and potentially upload them to LFS while creating a pointer in their place or, inversely, downloading them from LFS and replacing the LFS pointer with the file.
NOTE: this issue is about removing a file FROM LFS – see https://gitlab.com/gitlab-org/gitlab-ce/issues/42288 for moving a file TO LFS
Why
Not doing so can result in the repo being left in an improper state, which can result in git making changes to the working tree on checkout. This in turn can break some automated scripts.