Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@jeremy-coulon

Description

@jeremy-coulon

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions