Skip to content

chore(pre-commit): disallow large files#7576

Merged
jmelahman merged 1 commit intomainfrom
jamison/disallow-large-files
Jan 20, 2026
Merged

chore(pre-commit): disallow large files#7576
jmelahman merged 1 commit intomainfrom
jamison/disallow-large-files

Conversation

@jmelahman
Copy link
Copy Markdown
Contributor

@jmelahman jmelahman commented Jan 20, 2026

Description

Large files are easy to accidentally check in and very sticky in git history, so let's be intentional about checking them in.

There are currently 2 files over the limit, and neither are expected to be updated regularly,

-rw-r--r-- 1 jamison jamison 1.2M Jan 20 08:22 uv.lock
-rw-r--r-- 1 jamison jamison 4.0M Dec 29 14:11 backend/tests/integration/common_utils/test_files/Sample.pdf
-rw-r--r-- 1 jamison jamison 21M Dec 29 14:11 backend/hello-vmlinux.bin

How Has This Been Tested?

prek run --all-files

Additional Options

  • Override Linear Check

Summary by cubic

Add a pre-commit hook to block files larger than 1.5 MB from being committed. This prevents accidental large binaries and keeps git history lean.

  • New Features

    • Added check-added-large-files (pre-commit-hooks v6.0.0) with --maxkb=1500.
  • Migration

    • If a large file is required, use Git LFS or raise the limit; to bypass once, use git commit --no-verify.

Written for commit a705943. Summary will update on new commits.

@jmelahman jmelahman requested a review from a team as a code owner January 20, 2026 18:35
@jmelahman jmelahman force-pushed the jamison/disallow-large-files branch from a0add0b to 387b41b Compare January 20, 2026 18:35
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps bot commented Jan 20, 2026

Greptile Summary

Added a pre-commit hook to prevent accidentally committing large files (>1MB) to the repository, helping maintain git history cleanliness and repository performance.

  • Added check-added-large-files hook from pre-commit/pre-commit-hooks with --maxkb=1000 (1MB limit)
  • Hook only checks newly added files, so existing large files (uv.lock, Sample.pdf, hello-vmlinux.bin) are unaffected
  • Uses frozen commit hash for reproducibility

Confidence Score: 5/5

  • This PR is safe to merge with no risk
  • The change is minimal, well-scoped, and adds a standard pre-commit hook with appropriate configuration. The hook only blocks new large files from being committed, not affecting existing files. The 1MB threshold is reasonable and the implementation follows existing patterns in the config file.
  • No files require special attention

Important Files Changed

Filename Overview
.pre-commit-config.yaml Added check-added-large-files hook with 1MB threshold to prevent accidentally committing large files

Sequence Diagram

sequenceDiagram
    participant Dev as Developer
    participant Git as Git
    participant PreCommit as Pre-commit Framework
    participant Hook as check-added-large-files

    Dev->>Git: git add <files>
    Dev->>Git: git commit
    Git->>PreCommit: Trigger pre-commit hooks
    PreCommit->>Hook: Run check-added-large-files
    Hook->>Hook: Check each added file size
    alt File > 1000KB
        Hook->>PreCommit: Return failure
        PreCommit->>Git: Block commit
        Git->>Dev: Show error message
    else All files ≤ 1000KB
        Hook->>PreCommit: Return success
        PreCommit->>Git: Allow commit
        Git->>Dev: Commit successful
    end
Loading

@jmelahman jmelahman force-pushed the jamison/disallow-large-files branch from 387b41b to a705943 Compare January 20, 2026 18:37
@jmelahman jmelahman enabled auto-merge January 20, 2026 18:49
@jmelahman jmelahman disabled auto-merge January 20, 2026 19:01
@jmelahman jmelahman merged commit 2187b0d into main Jan 20, 2026
74 of 76 checks passed
@jmelahman jmelahman deleted the jamison/disallow-large-files branch January 20, 2026 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants