{"thread":{"id":"2374","subject":"[PATCH] Support for passing path to custom map in git-shortlog.perl","startedAt":"2005-11-06T23:07:57Z","lastAt":"2005-11-07T22:44:25Z","messageCount":4,"participants":["Petr Baudis","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"11228","messageId":"20051106230757.24941.19267.stgit@machine.or.cz","threadId":"2374","inReplyTo":null,"subject":"[PATCH] Support for passing path to custom map in git-shortlog.perl","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-11-06T23:07:57Z","receivedAt":"2005-11-06T23:07:57Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Aside of looking into .mailmap, add support for -m MAPFILE.\n\nSigned-off-by: Petr Baudis <pasky@suse.cz>\n---\n\n Documentation/git-shortlog.txt |   10 +++++++++-\n git-shortlog.perl              |   10 ++++++++++\n 2 files changed, 19 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-shortlog.txt b/Documentation/git-shortlog.txt\nindex 65ca77f..c8de78e 100644\n--- a/Documentation/git-shortlog.txt\n+++ b/Documentation/git-shortlog.txt\n@@ -8,13 +8,21 @@ git-shortlog - Summarize 'git log' outpu\n \n SYNOPSIS\n --------\n-'git-log --pretty=short | git shortlog'\n+'git-log --pretty=short | git shortlog [-m MAILMAP_FILE]'\n \n DESCRIPTION\n -----------\n Summarizes 'git log' output in a format suitable for inclusion\n in release announcements.\n \n+OPTIONS\n+-------\n+-m MAILMAP_FILE::\n+\tFile containing the email-to-realname mappings to be used\n+\tin case of the realname missing in the \"Author\" field of\n+\tthe commit. In addition, the '.mailmap' file and few predefined\n+\tmappings are also always searched.\n+\n \n Author\n ------\ndiff --git a/git-shortlog.perl b/git-shortlog.perl\nindex 7283159..cd83dbe 100755\n--- a/git-shortlog.perl\n+++ b/git-shortlog.perl\n@@ -1,6 +1,7 @@\n #!/usr/bin/perl -w\n \n use strict;\n+use Getopt::Std;\n \n my (%mailmap);\n my (%email);\n@@ -9,6 +10,9 @@ my $pstate = 1;\n my $n_records = 0;\n my $n_output = 0;\n \n+my (%opts);\n+getopts('m:', \\%opts);\n+\n sub shortlog_entry($$) {\n \tmy ($name, $desc) = @_;\n \tmy $key = $name;\n@@ -132,6 +136,12 @@ sub setup_mailmap {\n \t\tread_mailmap($fh, \\%mailmap);\n \t\tclose $fh;\n \t}\n+\tif ($opts{'m'}) {\n+\t\tmy $fh = undef;\n+\t\topen($fh, '<', $opts{'m'}) or die \"Cannot open mailmap $opts{m}: $!\";\n+\t\tread_mailmap($fh, \\%mailmap);\n+\t\tclose($fh);\n+\t}\n }\n \n sub finalize {\n"},{"id":"11232","messageId":"7vek5twc3u.fsf@assigned-by-dhcp.cox.net","threadId":"2374","inReplyTo":"20051106230757.24941.19267.stgit@machine.or.cz","subject":"Re: [PATCH] Support for passing path to custom map in git-shortlog.perl","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-07T00:11:33Z","receivedAt":"2005-11-07T00:11:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> Aside of looking into .mailmap, add support for -m MAPFILE.\n\nI thought about this when I did .mailmap because I felt \nthe more flexibility the better, but wouldn't maintaining the\nproject-wide .mailmap as part of the project easier to manage?\n"},{"id":"11272","messageId":"20051107215412.GU1431@pasky.or.cz","threadId":"2374","inReplyTo":"7vek5twc3u.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Support for passing path to custom map in git-shortlog.perl","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2005-11-07T21:54:12Z","receivedAt":"2005-11-07T21:54:12Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Mon, Nov 07, 2005 at 01:11:33AM CET, I got a letter\nwhere Junio C Hamano <junkio@cox.net> told me that...\n> Petr Baudis <pasky@suse.cz> writes:\n> \n> > Aside of looking into .mailmap, add support for -m MAPFILE.\n> \n> I thought about this when I did .mailmap because I felt \n> the more flexibility the better, but wouldn't maintaining the\n> project-wide .mailmap as part of the project easier to manage?\n\nOk, I'm not a die-hard proponent of this change (the genesis is that it\ncomes from the ages before .mailmap was supported and was originally\ncoupled with -n which disabled the internal mappings - but then .mailmap\ngot supported, I deemed -n useless but this still seemed worth something\nso I passed it along), but I think it can be useful - either when you\nwant to work on readonly tree, or when you want to support custom\nmailmap in addition to the default project's one without interference...\n*shrug*\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\nVI has two modes: the one in which it beeps and the one in which\nit doesn't.\n"},{"id":"11277","messageId":"7vr79sqdrq.fsf@assigned-by-dhcp.cox.net","threadId":"2374","inReplyTo":"20051107215412.GU1431@pasky.or.cz","subject":"Re: [PATCH] Support for passing path to custom map in git-shortlog.perl","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2005-11-07T22:44:25Z","receivedAt":"2005-11-07T22:44:25Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Petr Baudis <pasky@suse.cz> writes:\n\n> ... I think it can be useful - either when you\n> want to work on readonly tree, or when you want to support custom\n> mailmap in addition to the default project's one without interference...\n\nAh, that sort of makes sense.  On the other hand you could run\ngit-shortlog in a separate directory right now by piping the\ngit-log output to \"(cd somewhere && git-shortlog)\", so...\n\nCome to think of it, why not make git-shortlog take the same set\nof parameters as git-log takes (perhaps except --pretty)?  Then \nthe issues you raised starts to make sense and we would\ncertainly want -m MAPFILE option there.\n"}]}