Push rules do not apply to LFS
Push rules do not apply to LFS uploads.
Steps to reproduce
Apply a filename push rule
- Push a large zip file (3mb+)
git clone <project> cd <project folder> git lfs install git lfs track "*.zip" git add .gitattributes git commit -m "added lfs" git push echo "not a zip" > somefile.zip git add somefile.zip git commit -m "zip file" git push
The commit is rejected and the file is not uploaded via LFS.
The commit is rejected and the file is sent and saved via LFS.
We get a failure because of the file not being allowed thanks to the hook above. That's great... However, it appears the file DOES still get sent to the server with LFS. Whether this is a bug with LFS or a bug in GitLab still allowing the file to be written to the server, I don't know... I just feel it could be a concern if someone tried to push a huge file anyway and it failed but truly got pushed.
Second question: Could there be an option to allow Git LFS to ignore the prohibited file names and size limit? In other words, if I was using LFS to read zip files, then the above would actually work. But if I didn't use Git LFS, it would fail saying it doesn't match the requirements? Basically, we want to restrict people from pushing large files to GitLab unless they're using LFS. If they use LFS, then they can push the large files plus 'prohibited file names' without any issues.