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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Oct 08, 2010 at 02:44:05PM -0500, Dun Peal wrote:

> On Fri, Oct 8, 2010 at 8:50 AM, Jeff King <peff@xxxxxxxx> wrote:
> > You can do:
> >
> > Âgit ls-files | tr A-Z a-z | sort | uniq -d
> 
> Thanks, but the main issue is that this is a very large repository
> with tens of thousands of paths (files and directories).
> 
> git ls-files thus takes a long time, almost a second. Since this is a
> commit-heavy repo, I'd rather avoid that overhead.

I don't think you will find a solution that is faster. ls-files is just
reading the list of files from git's index file. I'm not seeing anything
near that long to do an ls-files on my machine:

  $ cd linux-2.6
  $ git ls-files | wc -l
  34296
  $ time git ls-files >/dev/null
  real    0m0.034s
  user    0m0.028s
  sys     0m0.012s

One thing to consider, though, is if this is a hook running on the
server, you probably don't want to look at the index. You probably want
to look for duplicates in one tree entry (fed to the hook). So you would
be using git ls-tree, which probably is a bit slower.

-Peff
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]