Efficiently detecting paths that differ from each other only in case
- From
Dun Peal <dunpealer@gmail.com>
- Date
- Oct 8, 2010, 06:13 UTC
- Message-ID
- <AANLkTimGAbosbD0pprROu_g-UW38faotYA2dTxj9scsP@mail.gmail.com>
Hi,
I'm writing a Git hook, for a bare central repo, to reject pushes of paths that differ from existing tracked paths only by letter case.
So, for example, if the following path is tracked in the repo:
foo/bar.py
Commits adding any of the following paths would be rejected:
Foo/bar.py foo/Bar.py fOO/BAR.py
Etc. I know how to do it by listing paths with ls-files, but my repo contains many thousands of files, so I was wondering if there was a more efficient way than for every commit:
1. Get a list of all paths in the repo from ls-files. 2. Lowercase all paths. 3. Check for repeats.
Thanks, D