From: Jonathan Nieder <jrnieder@gmail.com>
To: Dun Peal <dunpealer@gmail.com>
Cc: Jeff King <peff@peff.net>, git@vger.kernel.org
Subject: Re: Efficiently detecting paths that differ from each other only in case
Date: Fri, 8 Oct 2010 14:56:58 -0500 [thread overview]
Message-ID: <20101008195658.GF14311@burratino> (raw)
In-Reply-To: <AANLkTik6pSJFUkY9sooSH7iANaKLhxdN+ouKRXJn1B9G@mail.gmail.com>
Dun Peal wrote:
> 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
prev parent reply other threads:[~2010-10-08 20:01 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-08 6:13 Efficiently detecting paths that differ from each other only in case Dun Peal
2010-10-08 13:50 ` Jeff King
2010-10-08 19:44 ` Dun Peal
2010-10-08 19:51 ` Jeff King
2010-10-08 19:57 ` Dun Peal
2010-10-08 20:06 ` Jeff King
2010-10-08 22:57 ` Dun Peal
2010-10-09 8:47 ` Jakub Narebski
2010-10-09 22:00 ` Dun Peal
2010-10-09 22:31 ` Jakub Narebski
2010-10-11 3:07 ` Jeff King
2010-10-16 22:37 ` Dun Peal
2010-10-17 4:25 ` Jeff King
2010-10-08 19:56 ` Jonathan Nieder [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101008195658.GF14311@burratino \
--to=jrnieder@gmail.com \
--cc=dunpealer@gmail.com \
--cc=git@vger.kernel.org \
--cc=peff@peff.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.