question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

check-added-large-files doesn't work with --all-files

See original GitHub issue

check-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:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
asottilecommented, Apr 9, 2021

@nabobalis for non-lfs, check the README – this issue is specific to lfs so commenting about non-lfs is off topic

0reactions
nabobaliscommented, Apr 9, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found