Skip to content

Conversation

@lmmx
Copy link
Contributor

@lmmx lmmx commented Oct 14, 2025

Description

Implementing the check-case-conflict hook which ensures you don't check in files that would be the same on case-insensitive file systems (I think this is a Windows thing).

This is a widely used hook, 4.8k repos on grep.app.

  • No new dependencies.
  • It needed one new git function to mirror the equivalent one in the Python original implementation.
  • Unit tests and snapshot tests included

Binary Size Change
+0.63% (.text: 16.0 MiB → 16.1 MiB)

Demo

The most popular repo with this hook is jupyter/notebook

The hook takes 0.08s to run on pre-commit and 0.12s on prek (50% slower)

louis 🌟 ~/tmp/notebook $ runpc --verbose
check for case conflicts.................................................Passed
- hook id: check-case-conflict
- duration: 0.08s
check toml...............................................................Passed
- hook id: check-toml
- duration: 0.03s
check yaml...............................................................Passed
- hook id: check-yaml
- duration: 0.04s
louis 🌟 ~/tmp/notebook $ runpk --verbose
real    0m0.339s
user    0m1.255s
sys     0m0.292s
check for case conflicts.................................................Passed
- hook id: check-case-conflict
- duration: 0.12s
check toml...............................................................Passed
- hook id: check-toml
- duration: 0.00s
check yaml...............................................................Passed
- hook id: check-yaml
- duration: 0.00s

After installing from this local feature branch version, it runs instantly 🎉

louis 🌟 ~/tmp/notebook $ time runpk --verbose
check for case conflicts.................................................Passed
- hook id: check-case-conflict
- duration: 0.00s

@codecov
Copy link

codecov bot commented Oct 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.14%. Comparing base (7069606) to head (607b9f0).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #888      +/-   ##
==========================================
+ Coverage   90.02%   90.14%   +0.11%     
==========================================
  Files          64       65       +1     
  Lines       11999    12140     +141     
==========================================
+ Hits        10802    10943     +141     
  Misses       1197     1197              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@lmmx
Copy link
Contributor Author

lmmx commented Oct 14, 2025

Ha! The snapshots have broken on Windows and macOS because those filesystems are indeed case insensitive by default so the files are never produced so there is no conflict, as the filesystem prevents you from creating those files in the same directory so the conflicts never exist in the first place!

Screenshot from 2025-10-14 23-25-14

In which case: those tests should be skipped on those platforms

edit rather than skip those tests depending on platform, I returned early so as to confirm the assumption still holds (it did), now all the CI tests pass

@lmmx lmmx force-pushed the check-case-conflict branch from 21c27ed to 6127865 Compare October 14, 2025 22:35
@lmmx lmmx mentioned this pull request Oct 15, 2025
34 tasks
@lmmx lmmx force-pushed the check-case-conflict branch 5 times, most recently from a236432 to 3876679 Compare October 19, 2025 08:59
@lmmx lmmx force-pushed the check-case-conflict branch from 3876679 to 607b9f0 Compare October 19, 2025 10:27
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.

1 participant