git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Patrick Steinhardt <ps@pks.im>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	 Kristoffer Haugsbakk <kristofferhaugsbakk@fastmail.com>,
	 Matthieu Moy <git@matthieu-moy.fr>,
	Eric Sunshine <sunshine@sunshineco.com>,
	 Todd Zullinger <tmz@pobox.com>, Elijah Newren <newren@gmail.com>
Subject: [PATCH v3 11/11] contrib: remove some scripts in "stats" directory
Date: Mon, 12 May 2025 11:20:01 +0200	[thread overview]
Message-ID: <20250512-pks-contrib-spring-cleanup-v3-11-32e151b0bfb0@pks.im> (raw)
In-Reply-To: <20250512-pks-contrib-spring-cleanup-v3-0-32e151b0bfb0@pks.im>

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>
---
 contrib/stats/git-common-hash | 26 ----------------
 contrib/stats/mailmap.pl      | 70 -------------------------------------------
 2 files changed, 96 deletions(-)

diff --git a/contrib/stats/git-common-hash b/contrib/stats/git-common-hash
deleted file mode 100755
index e27fd088be1..00000000000
--- 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 9513f5e35b4..00000000000
--- 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";
-}

-- 
2.49.0.1101.gccaa498523.dirty


  parent reply	other threads:[~2025-05-12  9:20 UTC|newest]

Thread overview: 87+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-05-06 14:12 [PATCH 00/10] Spring cleanup of "contrib/" Patrick Steinhardt
2025-05-06 14:12 ` [PATCH 01/10] contrib: remove "remotes2config.sh" Patrick Steinhardt
2025-05-06 19:52   ` Junio C Hamano
2025-05-07  6:27     ` Patrick Steinhardt
2025-05-07 17:21       ` Junio C Hamano
2025-05-06 14:12 ` [PATCH 02/10] contrib: remove "examples" directory Patrick Steinhardt
2025-05-06 14:12 ` [PATCH 03/10] contrib: remove remote-helper stubs Patrick Steinhardt
2025-05-06 14:12 ` [PATCH 04/10] contrib: remove "thunderbird-patch-inline" Patrick Steinhardt
2025-05-06 14:12 ` [PATCH 05/10] contrib: remove "hooks" directory Patrick Steinhardt
2025-05-06 14:12 ` [PATCH 06/10] contrib: remove "mw-to-git" Patrick Steinhardt
2025-05-06 20:34   ` Junio C Hamano
2025-05-07  9:11     ` Matthieu Moy
2025-05-06 14:12 ` [PATCH 07/10] contrib: remove "persistent-https" remote helper Patrick Steinhardt
2025-05-06 20:25   ` Junio C Hamano
2025-05-06 14:12 ` [PATCH 08/10] contrib: remove "git-resurrect.sh" Patrick Steinhardt
2025-05-06 20:11   ` Junio C Hamano
2025-05-07  6:58     ` Patrick Steinhardt
2025-05-07 17:48       ` Junio C Hamano
2025-05-07 18:36     ` Kristoffer Haugsbakk
2025-05-06 14:12 ` [PATCH 09/10] contrib: remove "emacs" directory Patrick Steinhardt
2025-05-06 19:59   ` Junio C Hamano
2025-05-06 14:12 ` [PATCH 10/10] contrib: remove "git-new-workdir" Patrick Steinhardt
2025-05-06 19:57   ` Junio C Hamano
2025-05-07  6:27     ` Patrick Steinhardt
2025-05-07 17:25       ` Junio C Hamano
2025-05-09  7:53         ` Patrick Steinhardt
2025-05-06 20:43 ` [PATCH 00/10] Spring cleanup of "contrib/" Junio C Hamano
2025-05-06 22:51   ` Eric Sunshine
2025-05-07  1:32     ` Todd Zullinger
2025-05-07  3:55       ` Eric Sunshine
2025-05-07  6:27         ` Patrick Steinhardt
2025-05-10 20:07         ` D. Ben Knoble
2025-05-12 13:10           ` Phillip Wood
2025-05-09  9:17 ` [PATCH v2 00/11] " Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 01/11] contrib: remove "remotes2config.sh" Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 02/11] contrib: remove "examples" directory Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 03/11] contrib: remove remote-helper stubs Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 04/11] contrib: remove "thunderbird-patch-inline" Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 05/11] contrib: remove "hooks" directory Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 06/11] contrib: remove "mw-to-git" Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 07/11] contrib: remove "persistent-https" remote helper Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 08/11] contrib: remove "git-resurrect.sh" Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 09/11] contrib: remove "emacs" directory Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 10/11] contrib: remove "git-new-workdir" Patrick Steinhardt
2025-05-09  9:17   ` [PATCH v2 11/11] contrib: remove "stats" directory Patrick Steinhardt
2025-05-09 23:31     ` Elijah Newren
2025-05-09 23:53   ` [PATCH v2 00/11] Spring cleanup of "contrib/" Elijah Newren
2025-05-10  0:00     ` Junio C Hamano
2025-05-12  9:39     ` Patrick Steinhardt
2025-05-12  4:05   ` [PATCH v2 04/11] contrib: remove "thunderbird-patch-inline" Collin Funk
2025-05-12 13:02     ` Phillip Wood
2025-05-12 14:45       ` Patrick Steinhardt
2025-05-12 16:22       ` Junio C Hamano
2025-05-14 15:19         ` Phillip Wood
2025-05-16 13:53       ` [PATCH v2] contrib: update thunderbird-patch-inline Phillip Wood
2025-05-16 14:05         ` Kristoffer Haugsbakk
2025-05-19  5:38         ` Patrick Steinhardt
2025-05-19  5:50           ` Collin Funk
2025-05-19 14:21           ` Phillip Wood
2025-06-03 22:12             ` Junio C Hamano
2025-05-19 15:48           ` Junio C Hamano
2025-05-10 12:30 ` [PATCH 00/10] Spring cleanup of "contrib/" Peter Krefting
2025-05-12  9:19 ` [PATCH v3 00/11] " Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 01/11] contrib: remove "remotes2config.sh" Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 02/11] contrib: remove "examples" directory Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 03/11] contrib: remove remote-helper stubs Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 04/11] contrib: remove "thunderbird-patch-inline" Patrick Steinhardt
2025-05-16 22:49     ` Junio C Hamano
2025-05-26  8:47       ` Toon Claes
2025-06-04 14:45       ` Junio C Hamano
2025-05-12  9:19   ` [PATCH v3 05/11] contrib: remove "hooks" directory Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 06/11] contrib: remove "mw-to-git" Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 07/11] contrib: remove "persistent-https" remote helper Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 08/11] contrib: remove "git-resurrect.sh" Patrick Steinhardt
2025-05-12  9:19   ` [PATCH v3 09/11] contrib: remove "emacs" directory Patrick Steinhardt
2025-05-12  9:20   ` [PATCH v3 10/11] contrib: remove "git-new-workdir" Patrick Steinhardt
2025-09-08  9:28     ` Gabriel Scherer
2025-09-08  9:58       ` Kristoffer Haugsbakk
2025-09-08 15:22         ` Gabriel Scherer
2025-09-12 18:14           ` D. Ben Knoble
2025-09-12 18:55             ` Gabriel Scherer
2025-09-12 22:21               ` Junio C Hamano
2025-09-12 20:05           ` Phillip Wood
2025-09-12 22:19             ` Junio C Hamano
2025-09-08 18:43         ` Junio C Hamano
2025-05-12  9:20   ` Patrick Steinhardt [this message]
2025-05-13  2:53   ` [PATCH v3 00/11] Spring cleanup of "contrib/" Elijah Newren

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250512-pks-contrib-spring-cleanup-v3-11-32e151b0bfb0@pks.im \
    --to=ps@pks.im \
    --cc=git@matthieu-moy.fr \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=kristofferhaugsbakk@fastmail.com \
    --cc=newren@gmail.com \
    --cc=sunshine@sunshineco.com \
    --cc=tmz@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).