All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Baudis <pasky@suse.cz>
To: Junio C Hamano <junkio@cox.net>
Cc: <git@vger.kernel.org>
Subject: [PATCH] Support for passing path to custom map in git-shortlog.perl
Date: Mon, 07 Nov 2005 00:07:57 +0100	[thread overview]
Message-ID: <20051106230757.24941.19267.stgit@machine.or.cz> (raw)

Aside of looking into .mailmap, add support for -m MAPFILE.

Signed-off-by: Petr Baudis <pasky@suse.cz>
---

 Documentation/git-shortlog.txt |   10 +++++++++-
 git-shortlog.perl              |   10 ++++++++++
 2 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt
index 65ca77f..c8de78e 100644
--- a/Documentation/git-shortlog.txt
+++ b/Documentation/git-shortlog.txt
@@ -8,13 +8,21 @@ git-shortlog - Summarize 'git log' outpu
 
 SYNOPSIS
 --------
-'git-log --pretty=short | git shortlog'
+'git-log --pretty=short | git shortlog [-m MAILMAP_FILE]'
 
 DESCRIPTION
 -----------
 Summarizes 'git log' output in a format suitable for inclusion
 in release announcements.
 
+OPTIONS
+-------
+-m MAILMAP_FILE::
+	File containing the email-to-realname mappings to be used
+	in case of the realname missing in the "Author" field of
+	the commit. In addition, the '.mailmap' file and few predefined
+	mappings are also always searched.
+
 
 Author
 ------
diff --git a/git-shortlog.perl b/git-shortlog.perl
index 7283159..cd83dbe 100755
--- a/git-shortlog.perl
+++ b/git-shortlog.perl
@@ -1,6 +1,7 @@
 #!/usr/bin/perl -w
 
 use strict;
+use Getopt::Std;
 
 my (%mailmap);
 my (%email);
@@ -9,6 +10,9 @@ my $pstate = 1;
 my $n_records = 0;
 my $n_output = 0;
 
+my (%opts);
+getopts('m:', \%opts);
+
 sub shortlog_entry($$) {
 	my ($name, $desc) = @_;
 	my $key = $name;
@@ -132,6 +136,12 @@ sub setup_mailmap {
 		read_mailmap($fh, \%mailmap);
 		close $fh;
 	}
+	if ($opts{'m'}) {
+		my $fh = undef;
+		open($fh, '<', $opts{'m'}) or die "Cannot open mailmap $opts{m}: $!";
+		read_mailmap($fh, \%mailmap);
+		close($fh);
+	}
 }
 
 sub finalize {

             reply	other threads:[~2005-11-06 23:08 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-06 23:07 Petr Baudis [this message]
2005-11-07  0:11 ` [PATCH] Support for passing path to custom map in git-shortlog.perl Junio C Hamano
2005-11-07 21:54   ` Petr Baudis
2005-11-07 22:44     ` Junio C Hamano

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=20051106230757.24941.19267.stgit@machine.or.cz \
    --to=pasky@suse.cz \
    --cc=git@vger.kernel.org \
    --cc=junkio@cox.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.