Re: Basename matching during rename/copy detection
- From
Jeff King <peff@peff.net>
- Date
- Jun 21, 2007, 13:10 UTC
- Message-ID
- <20070621131047.GC4487@coredump.intra.peff.net>
- In-Reply-To
- <vpqodj9zcxf.fsf@bauges.imag.fr>
On Thu, Jun 21, 2007 at 02:53:32PM +0200, Matthieu Moy wrote:
Show 8 quoted lines
> Well, why look so far to find an example of people having identical > files in their tree? > > $ cd git > $ git-ls-files -z | xargs -0 md5sum | cut -f 1 -d ' ' | wc -l > 973 > $ git-ls-files -z | xargs -0 md5sum | cut -f 1 -d ' ' | sort | uniq | wc -l > 964
md5? What is this, CVS? How about:
git-ls-files -s | cut -d' ' -f2 | sort | uniq -d | wc -l
Your pipeline will also list files in the working directory, which can inflate the number of duplicates (note that git-foo.sh and git-foo will have the same content).
-Peff
PS Please don't take this to mean I think duplicate files are stupid; I think they can be quite useful. I just wanted to nitpick your shell command. :)