git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Support for passing path to custom map in git-shortlog.perl
@ 2005-11-06 23:07 Petr Baudis
  2005-11-07  0:11 ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2005-11-06 23:07 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

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 {

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Support for passing path to custom map in git-shortlog.perl
  2005-11-06 23:07 [PATCH] Support for passing path to custom map in git-shortlog.perl Petr Baudis
@ 2005-11-07  0:11 ` Junio C Hamano
  2005-11-07 21:54   ` Petr Baudis
  0 siblings, 1 reply; 4+ messages in thread
From: Junio C Hamano @ 2005-11-07  0:11 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

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

I thought about this when I did .mailmap because I felt 
the more flexibility the better, but wouldn't maintaining the
project-wide .mailmap as part of the project easier to manage?

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Support for passing path to custom map in git-shortlog.perl
  2005-11-07  0:11 ` Junio C Hamano
@ 2005-11-07 21:54   ` Petr Baudis
  2005-11-07 22:44     ` Junio C Hamano
  0 siblings, 1 reply; 4+ messages in thread
From: Petr Baudis @ 2005-11-07 21:54 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: git

Dear diary, on Mon, Nov 07, 2005 at 01:11:33AM CET, I got a letter
where Junio C Hamano <junkio@cox.net> told me that...
> Petr Baudis <pasky@suse.cz> writes:
> 
> > Aside of looking into .mailmap, add support for -m MAPFILE.
> 
> I thought about this when I did .mailmap because I felt 
> the more flexibility the better, but wouldn't maintaining the
> project-wide .mailmap as part of the project easier to manage?

Ok, I'm not a die-hard proponent of this change (the genesis is that it
comes from the ages before .mailmap was supported and was originally
coupled with -n which disabled the internal mappings - but then .mailmap
got supported, I deemed -n useless but this still seemed worth something
so I passed it along), but I think it can be useful - either when you
want to work on readonly tree, or when you want to support custom
mailmap in addition to the default project's one without interference...
*shrug*

-- 
				Petr "Pasky" Baudis
Stuff: http://pasky.or.cz/
VI has two modes: the one in which it beeps and the one in which
it doesn't.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Support for passing path to custom map in git-shortlog.perl
  2005-11-07 21:54   ` Petr Baudis
@ 2005-11-07 22:44     ` Junio C Hamano
  0 siblings, 0 replies; 4+ messages in thread
From: Junio C Hamano @ 2005-11-07 22:44 UTC (permalink / raw)
  To: Petr Baudis; +Cc: git

Petr Baudis <pasky@suse.cz> writes:

> ... I think it can be useful - either when you
> want to work on readonly tree, or when you want to support custom
> mailmap in addition to the default project's one without interference...

Ah, that sort of makes sense.  On the other hand you could run
git-shortlog in a separate directory right now by piping the
git-log output to "(cd somewhere && git-shortlog)", so...

Come to think of it, why not make git-shortlog take the same set
of parameters as git-log takes (perhaps except --pretty)?  Then 
the issues you raised starts to make sense and we would
certainly want -m MAPFILE option there.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2005-11-07 22:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-06 23:07 [PATCH] Support for passing path to custom map in git-shortlog.perl Petr Baudis
2005-11-07  0:11 ` Junio C Hamano
2005-11-07 21:54   ` Petr Baudis
2005-11-07 22:44     ` Junio C Hamano

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).