{"thread":{"id":"32307","subject":"Use of a mailmap file with git-log","startedAt":"2012-12-10T18:22:49Z","lastAt":"2012-12-10T20:16:14Z","messageCount":6,"participants":["Rich Midwinter","Junio C Hamano","Antoine Pelisse"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"204658","messageId":"CALKB1SXdNVsQop5VYmShOMx93+j5SPdkGF9yNU5k7nXg87TwMw@mail.gmail.com","threadId":"32307","inReplyTo":null,"subject":"Use of a mailmap file with git-log","fromName":"Rich Midwinter","fromEmail":"rich.midwinter@gmail.com","sentAt":"2012-12-10T18:22:49Z","receivedAt":"2012-12-10T18:22:49Z","isPatch":false,"sender":{"key":"rich.midwinter@gmail.com","avatar":null},"body":"Hi\n\nI'm working on a project for a large organisation that wants to make\nwidespread use of git and the mailmap feature.\n\nThis seems to be supported by default in git-shortlog but not git-log\n(and other variants) without specifying custom formats, which isn't\nreally something I want to try and 'fix' across the organisation. Is\nthere a reason for this feature omission or has it just evolved that\nway and could it be fixed?\n\nThanks\nRich\n"},{"id":"204659","messageId":"7v38zdbv6d.fsf@alter.siamese.dyndns.org","threadId":"32307","inReplyTo":"CALKB1SXdNVsQop5VYmShOMx93+j5SPdkGF9yNU5k7nXg87TwMw@mail.gmail.com","subject":"Re: Use of a mailmap file with git-log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-10T18:48:10Z","receivedAt":"2012-12-10T18:48:10Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Rich Midwinter <rich.midwinter@gmail.com> writes:\n\n> I'm working on a project for a large organisation that wants to make\n> widespread use of git and the mailmap feature.\n>\n> This seems to be supported by default in git-shortlog but not git-log\n> (and other variants) without specifying custom formats, which isn't\n> really something I want to try and 'fix' across the organisation. Is\n> there a reason for this feature omission or has it just evolved that\n> way and could it be fixed?\n\nI think it was pretty much the latter, but people may already be\ndepending on the command to give them the \"true as recorded back\nthen\" names in the output.  A fix may have to involve inventing a\nnew option \"log --use-mailmap\" that is explicitly given from the\ncommand line.\n"},{"id":"204661","messageId":"7vobi1ae26.fsf@alter.siamese.dyndns.org","threadId":"32307","inReplyTo":"7v38zdbv6d.fsf@alter.siamese.dyndns.org","subject":"Re: Use of a mailmap file with git-log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-10T19:43:13Z","receivedAt":"2012-12-10T19:43:13Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Rich Midwinter <rich.midwinter@gmail.com> writes:\n>\n>> I'm working on a project for a large organisation that wants to make\n>> widespread use of git and the mailmap feature.\n>>\n>> This seems to be supported by default in git-shortlog but not git-log\n>> (and other variants) without specifying custom formats, which isn't\n>> really something I want to try and 'fix' across the organisation. Is\n>> there a reason for this feature omission or has it just evolved that\n>> way and could it be fixed?\n>\n> I think it was pretty much the latter, but people may already be\n> depending on the command to give them the \"true as recorded back\n> then\" names in the output.  A fix may have to involve inventing a\n> new option \"log --use-mailmap\" that is explicitly given from the\n> command line.\n\nIf somebody wants to do this, I think the overall design should go\nlike this:\n\n * We may want to rewrite blame.c::get_ac_line() and the code in\n   pretty.c::pp_user_info() that parse author/committer lines by\n   using ident.c::split_ident_line() for better code reuse as a\n   preparation step before all of the below.\n\n * We may want to lift the buffer length limit from the implementation\n   of mailmap.c::map_user() by using the strbuf API as a preparation\n   step before all of the below.\n\n * We may also want to rethink its signature (we may want to get a\n   single strbuf and have the function parse out \"Name <mail>\"; I\n   didn't check the existing callers to see if that would make it\n   easier to use, and if it does not, this obviously shouldn't be done)\n   as a preparation step before all of the below.\n\n * Introduce a new \"struct string_list *mailmap\" member to \"struct\n   pretty_print_context\" and \"struct rev_info\" (default to NULL);\n\n * In log-tree.c::show_log(), copy opt->mailmap to ctx.mailmap;\n\n * Update pretty.c::pp_user_info() to convert the email address on\n   \"line\" (between the beginning and \"namelen\") by calling\n   map_user() immediately after it parses time/tz out, and adjust\n   the remainder of the function to use it, when pp->mailmap is\n   present;\n\n * Teach log.c::cmd_log_init_finosh() about \"--use-mailmap\" option.\n   Allocate one \"struct string_list\" instance and use read_mailmap()\n   on it when the option is used, and store it in rev->mailmap.\n"},{"id":"204662","messageId":"CALWbr2ydMkR_O-Gev7k-HjGadRJMv0UH3XdqtM0Jt=vC82GwJw@mail.gmail.com","threadId":"32307","inReplyTo":"7v38zdbv6d.fsf@alter.siamese.dyndns.org","subject":"Re: Use of a mailmap file with git-log","fromName":"Antoine Pelisse","fromEmail":"apelisse@gmail.com","sentAt":"2012-12-10T19:47:21Z","receivedAt":"2012-12-10T19:47:21Z","isPatch":false,"sender":{"key":"apelisse@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1929644?v=4"},"body":"Hi,\n\nI was thinking about that last week.\nIt could indeed be very interesting to have mailmap applied to git-log and\nespecially to git-log --author/--committer.\n\nMy first look at the code let me think that we would need to change the\nparse_commit_buffer to replace, at reading time, the name of author and\ncommitter if an option (--use-mailmap seems like a wise choice) and\nprobably a config option.\nThe choice of parse_commit_buffer to do the modification is due to\nthe grepping being done directly on buffer when grepping author/committerer.\n\nYet I'm afraid it could be:\n1. expensive to rewrite all commit log (reallocating the buffer)\n2. Inappropriate to change the value in function that is supposed to\nread\n\nMy 2 cents.\n\nCheers,\n\nOn Mon, Dec 10, 2012 at 7:48 PM, Junio C Hamano <gitster@pobox.com> wrote:\n> Rich Midwinter <rich.midwinter@gmail.com> writes:\n>\n>> I'm working on a project for a large organisation that wants to make\n>> widespread use of git and the mailmap feature.\n>>\n>> This seems to be supported by default in git-shortlog but not git-log\n>> (and other variants) without specifying custom formats, which isn't\n>> really something I want to try and 'fix' across the organisation. Is\n>> there a reason for this feature omission or has it just evolved that\n>> way and could it be fixed?\n>\n> I think it was pretty much the latter, but people may already be\n> depending on the command to give them the \"true as recorded back\n> then\" names in the output.  A fix may have to involve inventing a\n> new option \"log --use-mailmap\" that is explicitly given from the\n> command line.\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"204663","messageId":"7vk3spad0k.fsf@alter.siamese.dyndns.org","threadId":"32307","inReplyTo":"CALWbr2ydMkR_O-Gev7k-HjGadRJMv0UH3XdqtM0Jt=vC82GwJw@mail.gmail.com","subject":"Re: Use of a mailmap file with git-log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-10T20:05:47Z","receivedAt":"2012-12-10T20:05:47Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Antoine Pelisse <apelisse@gmail.com> writes:\n\n> Yet I'm afraid it could be:\n> 1. expensive to rewrite all commit log (reallocating the buffer)\n> 2. Inappropriate to change the value in function that is supposed to\n> read\n\nIn my suggestion I avoided rewriting the log buffer, primarily\nbecause of #2 (in addition to \"read\" cleanliness, such a change may\nbreak the gpg signature checking for merges).\n\nWe do reencode the contents before we write it out when \"encoding\"\nis present, so logically such a rewrite of authors and committers\nbelongs to where that happens, in pretty_print_commit().  Note that\nthis existing rewrite is not done to the commit log buffer but is to\na separate buffer meant to be used only for output.\n"},{"id":"204664","messageId":"7vfw3dacj5.fsf@alter.siamese.dyndns.org","threadId":"32307","inReplyTo":"CALWbr2ydMkR_O-Gev7k-HjGadRJMv0UH3XdqtM0Jt=vC82GwJw@mail.gmail.com","subject":"Re: Use of a mailmap file with git-log","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2012-12-10T20:16:14Z","receivedAt":"2012-12-10T20:16:14Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Antoine Pelisse <apelisse@gmail.com> writes:\n\n> It could indeed be very interesting to have mailmap applied to git-log and\n> especially to git-log --author/--committer.\n> ...\n> The choice of parse_commit_buffer to do the modification is due to\n> the grepping being done directly on buffer when grepping author/committerer.\n\nFor pattern matching, I think revision.c::commit_match() is probably\nthe right place to do this kind of thing.  I just noticed that we\ngrep for the string inside a raw buffer, even when \"encoding\" is\nspecified, which I think is a bug.\n"}]}