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

Re: Efficiently detecting paths that differ from each other only in case

From
Jonathan Nieder <jrnieder@gmail.com>
Date
Oct 8, 2010, 19:56 UTC
Message-ID
<20101008195658.GF14311@burratino>
In-Reply-To
<AANLkTik6pSJFUkY9sooSH7iANaKLhxdN+ouKRXJn1B9G@mail.gmail.com>
Dun Peal wrote:
Show 7 quoted lines
> git ls-files thus takes a long time, almost a second. Since this is a
> commit-heavy repo, I'd rather avoid that overhead.
> 
> Incidentally, there's an SVN hook that does the exact same thing that
> I want to do:
> 
> http://svn.apache.org/repos/asf/subversion/trunk/contrib/hook-scripts/case-insensitive.py
Well, can't you do the same thing that hook does?
1. Decide on the desired semantics.

Should a broken push of multiple branches be entirely rejected, or just the broken branches? The answer determines whether you should be using a pre-receive or an update hook; see githooks(5).

2. Get a list of added files with git-diff-tree(1) --diff-filter.
3. Break file names into directory + basename.
4. For each directory with new files or subdirectories:
    - List its children in the new version with git-ls-tree(1)
    - Canonicalize path names
    - Find clashes
If this should be general-purpose, take care to handle:
 - new branches (<old-value> = 00000000...)
 - new subdirectory whose name clashes with an existing file
 - filename clash within a new subdirectory

Good luck, Jonathan

Previous: Jeff King
Message 14 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.