3
# This script displays the distribution of longest common hash prefixes.
4
# This can be used to determine the minimum prefix length to use
5
# for object names to be unique.
7
git rev-list --objects --all | sort | perl -lne '
9
# uncomment next line for a distribution of bits instead of hex chars
10
# $_ = unpack("B*",pack("H*",$_));
12
($p ^ $_) =~ /^(\0*)/;
14
if (defined $pcommon) {
15
$count[$pcommon > $common ? $pcommon : $common]++;
17
$count[$common]++; # first item
23
$count[$common]++; # last item
24
print "$_: $count[$_]" for 0..$#count;