git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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
Next: Jeff King
Message 1 of 14 in “Efficiently detecting paths that differ from each other only in case”
  1. Dun PealOct 8, 2010
  2. Jeff KingOct 8, 2010
  3. Dun PealOct 8, 2010
  4. Jeff KingOct 8, 2010
  5. Dun PealOct 8, 2010
  6. Jeff KingOct 8, 2010
  7. Dun PealOct 8, 2010
  8. Jakub NarebskiOct 9, 2010
  9. Dun PealOct 9, 2010
  10. Jakub NarebskiOct 9, 2010
  11. Jeff KingOct 11, 2010
  12. Dun PealOct 16, 2010
  13. Jeff KingOct 17, 2010
  14. Jonathan NiederOct 8, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.