Skip to content

Missing Warning Leads to Silent Data Loss When Committing Large Files (>4GB) #6012

@iyzyi

Description

@iyzyi

Existing issues matching what you're seeing

  • I was not able to find an open or closed issue matching what I'm seeing

Git for Windows version

git version 2.52.0.windows.1

Windows version

Windows 10

Windows CPU architecture

x86_64 (64-bit)

Additional Windows version information

Options set during installation

all default

Other interesting things

No response

Terminal/shell

cmd.exe

Commands that trigger the issue

create test.txt (>4GB)
git add .
git commit -m "test"
git ls-tree -l HEAD -- test.txt

Expected behaviour

corrent file length

Actual behaviour

file length dismatch

Repository

Git commit does not support individual files larger than 4 GB. If a file exceeds 4 GB, due to integer overflow, its length is truncated to len_new = len & 0xffffffff, and Git will only record the first len_new bytes of the file. Critically, this process produces no error or warning, making it very easy to lose content from large files.

Previously, through #3487 , Git LFS was introduced to allow large files to be stored. However, Git itself does not proactively warn users that files larger than 4 GB cannot be committed natively, leaving users unaware of which files should be submitted via LFS.

Is there any plan to fix this bug, or at least consider providing a warning to users to prevent loss of file content?

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