check-added-large-files doesn't work with --all-files
See original GitHub issuecheck-added-large-files hook doesn’t correctly detect files in LFS when running with option --all-files
Using git cat-file -s :$file
would be a better implementation in order to get size of a blob.
For example:
$ grep gif .gitattributes
*.gif filter=lfs diff=lfs merge=lfs -text
$ pre-commit run check-added-large-files --all-files
Check for added large files..............................................Failed
- hook id: check-added-large-files
- exit code: 1
avatar1.gif (1770 KB) exceeds 1024 KB.
$ git cat-file blob :avatar1.gif
version https://git-lfs.github.com/spec/v1
oid sha256:b506867cbae90bcb984fbdfdbfd06ac15b2f1bb2077741d2100552de2c0859b7
size 1812444
$ git cat-file -s :avatar1.gif
132
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
check-added-large-files prevent giant files from being committed
Specify what is “too large” with args: ['–maxkb=123'] (default=500kB). If git-lfs is installed, lfs files will be skipped (requires git-lfs>=2.2.1 ) ...
Read more >Issues with pushing large files through Git - Stack Overflow
It is possible that you are pushing several commits, one of them including a large file, and another more recent one removing that...
Read more >Fix problems uploading files on the OneDrive website
In this article, you'll find solutions for some of the error messages you might see when you're uploading files on the OneDrive website....
Read more >pre-commit
Add a file called .pre-commit-config.yaml to the root of your project. The pre-commit config file describes what repositories and hooks are installed.
Read more >Fix common issues in Google Drive
You can put large files in Drive, but if you exceed the size limits, they might not load properly. If your file is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@nabobalis for non-lfs, check the README – this issue is specific to lfs so commenting about non-lfs is off topic
I have this issue but for non-lfs files. I can add “–enforce-all” but I like to use “pre-commit run --all-files” on the CI and locally to spot problems.