aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2025-05-12 11:20:01 +0200
committerJunio C Hamano <gitster@pobox.com>2025-05-12 10:55:47 -0700
commitaf2a4b3eb75ca794514dd1e65f90f5d3417c34a0 (patch)
tree40c2b789a408a6b9e9e72aa56f8b49556ef7e470
parent15405cd325be6f51bea1115be6cc842d5b06f59d (diff)
downloadgit-af2a4b3eb75ca794514dd1e65f90f5d3417c34a0.tar.gz
contrib: remove some scripts in "stats" directory
The "stats" directory contains a couple of scripts to do some statistics on a repository: - "git-common-hash" shows the longest common hash prefixes and can be used to determine the minimum prefix length to use for object names to be unique. The script has last been touched in 53474eb92ff (contrib: update stats/mailmap script, 2012-12-12) and searching for it on the internet doesn't really surface any potential use cases or even mentions of it. Modern Git also shouldn't really need this tool as it knows to automatically scale printed prefixes via some heuristics. - "mailmap.pl" performs some statistics on the number of mailmapped commits in a repository. It has last been modified in 53474eb92ff (contrib: update stats/mailmap script, 2012-12-12) and has since been bitrotting. It doesn't even compile nowadays anymore: $ perl contrib/stats/mailmap.pl Experimental keys on scalar is now forbidden at contrib/stats/mailmap.pl line 57. Type of arg 1 to keys must be hash or array (not hash element) at contrib/stats/mailmap.pl line 57, near "}) " Experimental keys on scalar is now forbidden at contrib/stats/mailmap.pl line 57. Type of arg 1 to keys must be hash or array (not private variable) at contrib/stats/mailmap.pl line 57, near "$h)" Experimental keys on scalar is now forbidden at contrib/stats/mailmap.pl line 64. Type of arg 1 to keys must be hash or array (not private variable) at contrib/stats/mailmap.pl line 64, near "$h)" Execution of contrib/stats/mailmap.pl aborted due to compilation errors. This should be good-enough signal to indicate that nobody is using this script at all anymore. - "packinfo.pl" takes the output from git-verify-pack(1) and performs some pretty printing thereof. On the one hand it reformats the output to be easier to read and provide some summaries. On the other hand it may also print filenames of blobs. We don't have any replacement for this tool. Ideally, we should move its functionality into git-verify-pack(1) itself. Remove the first two scripts, but retain "packinfo.pl". Signed-off-by: Patrick Steinhardt <ps@pks.im> Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rwxr-xr-xcontrib/stats/git-common-hash26
-rwxr-xr-xcontrib/stats/mailmap.pl70
2 files changed, 0 insertions, 96 deletions
diff --git a/contrib/stats/git-common-hash b/contrib/stats/git-common-hash
deleted file mode 100755
index e27fd088be..0000000000
--- a/contrib/stats/git-common-hash
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/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;
- }
-'
diff --git a/contrib/stats/mailmap.pl b/contrib/stats/mailmap.pl
deleted file mode 100755
index 9513f5e35b..0000000000
--- a/contrib/stats/mailmap.pl
+++ /dev/null
@@ -1,70 +0,0 @@
-#!/usr/bin/perl
-
-use warnings 'all';
-use strict;
-use Getopt::Long;
-
-my $match_emails;
-my $match_names;
-my $order_by = 'count';
-Getopt::Long::Configure(qw(bundling));
-GetOptions(
- 'emails|e!' => \$match_emails,
- 'names|n!' => \$match_names,
- 'count|c' => sub { $order_by = 'count' },
- 'time|t' => sub { $order_by = 'stamp' },
-) or exit 1;
-$match_emails = 1 unless $match_names;
-
-my $email = {};
-my $name = {};
-
-open(my $fh, '-|', "git log --format='%at <%aE> %aN'");
-while(<$fh>) {
- my ($t, $e, $n) = /(\S+) <(\S+)> (.*)/;
- mark($email, $e, $n, $t);
- mark($name, $n, $e, $t);
-}
-close($fh);
-
-if ($match_emails) {
- foreach my $e (dups($email)) {
- foreach my $n (vals($email->{$e})) {
- show($n, $e, $email->{$e}->{$n});
- }
- print "\n";
- }
-}
-if ($match_names) {
- foreach my $n (dups($name)) {
- foreach my $e (vals($name->{$n})) {
- show($n, $e, $name->{$n}->{$e});
- }
- print "\n";
- }
-}
-exit 0;
-
-sub mark {
- my ($h, $k, $v, $t) = @_;
- my $e = $h->{$k}->{$v} ||= { count => 0, stamp => 0 };
- $e->{count}++;
- $e->{stamp} = $t unless $t < $e->{stamp};
-}
-
-sub dups {
- my $h = shift;
- return grep { keys($h->{$_}) > 1 } keys($h);
-}
-
-sub vals {
- my $h = shift;
- return sort {
- $h->{$b}->{$order_by} <=> $h->{$a}->{$order_by}
- } keys($h);
-}
-
-sub show {
- my ($n, $e, $h) = @_;
- print "$n <$e> ($h->{$order_by})\n";
-}