Server : Apache System : Linux server1.cgrithy.com 3.10.0-1160.95.1.el7.x86_64 #1 SMP Mon Jul 24 13:59:37 UTC 2023 x86_64 User : nobody ( 99) PHP Version : 8.1.23 Disable Function : NONE Directory : /usr/share/doc/git-1.8.3.1/contrib/stats/ |
#!/bin/sh # This script displays the distribution of longest common hash prefixes. # This can be used to determine the minimum prefix length to use # for object names to be unique. git rev-list --objects --all | sort | perl -lne ' substr($_, 40) = ""; # uncomment next line for a distribution of bits instead of hex chars # $_ = unpack("B*",pack("H*",$_)); if (defined $p) { ($p ^ $_) =~ /^(\0*)/; $common = length $1; if (defined $pcommon) { $count[$pcommon > $common ? $pcommon : $common]++; } else { $count[$common]++; # first item } } $p = $_; $pcommon = $common; END { $count[$common]++; # last item print "$_: $count[$_]" for 0..$#count; } '