git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Use of a mailmap file with git-log
@ 2012-12-10 18:22 Rich Midwinter
  2012-12-10 18:48 ` Junio C Hamano
  0 siblings, 1 reply; 6+ messages in thread
From: Rich Midwinter @ 2012-12-10 18:22 UTC (permalink / raw)
  To: git

Hi

I'm working on a project for a large organisation that wants to make
widespread use of git and the mailmap feature.

This seems to be supported by default in git-shortlog but not git-log
(and other variants) without specifying custom formats, which isn't
really something I want to try and 'fix' across the organisation. Is
there a reason for this feature omission or has it just evolved that
way and could it be fixed?

Thanks
Rich

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

* Re: Use of a mailmap file with git-log
  2012-12-10 18:22 Use of a mailmap file with git-log Rich Midwinter
@ 2012-12-10 18:48 ` Junio C Hamano
  2012-12-10 19:43   ` Junio C Hamano
  2012-12-10 19:47   ` Antoine Pelisse
  0 siblings, 2 replies; 6+ messages in thread
From: Junio C Hamano @ 2012-12-10 18:48 UTC (permalink / raw)
  To: Rich Midwinter; +Cc: git

Rich Midwinter <rich.midwinter@gmail.com> writes:

> I'm working on a project for a large organisation that wants to make
> widespread use of git and the mailmap feature.
>
> This seems to be supported by default in git-shortlog but not git-log
> (and other variants) without specifying custom formats, which isn't
> really something I want to try and 'fix' across the organisation. Is
> there a reason for this feature omission or has it just evolved that
> way and could it be fixed?

I think it was pretty much the latter, but people may already be
depending on the command to give them the "true as recorded back
then" names in the output.  A fix may have to involve inventing a
new option "log --use-mailmap" that is explicitly given from the
command line.

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

* Re: Use of a mailmap file with git-log
  2012-12-10 18:48 ` Junio C Hamano
@ 2012-12-10 19:43   ` Junio C Hamano
  2012-12-10 19:47   ` Antoine Pelisse
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2012-12-10 19:43 UTC (permalink / raw)
  To: git; +Cc: Rich Midwinter

Junio C Hamano <gitster@pobox.com> writes:

> Rich Midwinter <rich.midwinter@gmail.com> writes:
>
>> I'm working on a project for a large organisation that wants to make
>> widespread use of git and the mailmap feature.
>>
>> This seems to be supported by default in git-shortlog but not git-log
>> (and other variants) without specifying custom formats, which isn't
>> really something I want to try and 'fix' across the organisation. Is
>> there a reason for this feature omission or has it just evolved that
>> way and could it be fixed?
>
> I think it was pretty much the latter, but people may already be
> depending on the command to give them the "true as recorded back
> then" names in the output.  A fix may have to involve inventing a
> new option "log --use-mailmap" that is explicitly given from the
> command line.

If somebody wants to do this, I think the overall design should go
like this:

 * We may want to rewrite blame.c::get_ac_line() and the code in
   pretty.c::pp_user_info() that parse author/committer lines by
   using ident.c::split_ident_line() for better code reuse as a
   preparation step before all of the below.

 * We may want to lift the buffer length limit from the implementation
   of mailmap.c::map_user() by using the strbuf API as a preparation
   step before all of the below.

 * We may also want to rethink its signature (we may want to get a
   single strbuf and have the function parse out "Name <mail>"; I
   didn't check the existing callers to see if that would make it
   easier to use, and if it does not, this obviously shouldn't be done)
   as a preparation step before all of the below.

 * Introduce a new "struct string_list *mailmap" member to "struct
   pretty_print_context" and "struct rev_info" (default to NULL);

 * In log-tree.c::show_log(), copy opt->mailmap to ctx.mailmap;

 * Update pretty.c::pp_user_info() to convert the email address on
   "line" (between the beginning and "namelen") by calling
   map_user() immediately after it parses time/tz out, and adjust
   the remainder of the function to use it, when pp->mailmap is
   present;

 * Teach log.c::cmd_log_init_finosh() about "--use-mailmap" option.
   Allocate one "struct string_list" instance and use read_mailmap()
   on it when the option is used, and store it in rev->mailmap.

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

* Re: Use of a mailmap file with git-log
  2012-12-10 18:48 ` Junio C Hamano
  2012-12-10 19:43   ` Junio C Hamano
@ 2012-12-10 19:47   ` Antoine Pelisse
  2012-12-10 20:05     ` Junio C Hamano
  2012-12-10 20:16     ` Junio C Hamano
  1 sibling, 2 replies; 6+ messages in thread
From: Antoine Pelisse @ 2012-12-10 19:47 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: Rich Midwinter, git

Hi,

I was thinking about that last week.
It could indeed be very interesting to have mailmap applied to git-log and
especially to git-log --author/--committer.

My first look at the code let me think that we would need to change the
parse_commit_buffer to replace, at reading time, the name of author and
committer if an option (--use-mailmap seems like a wise choice) and
probably a config option.
The choice of parse_commit_buffer to do the modification is due to
the grepping being done directly on buffer when grepping author/committerer.

Yet I'm afraid it could be:
1. expensive to rewrite all commit log (reallocating the buffer)
2. Inappropriate to change the value in function that is supposed to
read

My 2 cents.

Cheers,

On Mon, Dec 10, 2012 at 7:48 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Rich Midwinter <rich.midwinter@gmail.com> writes:
>
>> I'm working on a project for a large organisation that wants to make
>> widespread use of git and the mailmap feature.
>>
>> This seems to be supported by default in git-shortlog but not git-log
>> (and other variants) without specifying custom formats, which isn't
>> really something I want to try and 'fix' across the organisation. Is
>> there a reason for this feature omission or has it just evolved that
>> way and could it be fixed?
>
> I think it was pretty much the latter, but people may already be
> depending on the command to give them the "true as recorded back
> then" names in the output.  A fix may have to involve inventing a
> new option "log --use-mailmap" that is explicitly given from the
> command line.
>
> --
> To unsubscribe from this list: send the line "unsubscribe git" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: Use of a mailmap file with git-log
  2012-12-10 19:47   ` Antoine Pelisse
@ 2012-12-10 20:05     ` Junio C Hamano
  2012-12-10 20:16     ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2012-12-10 20:05 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: Rich Midwinter, git

Antoine Pelisse <apelisse@gmail.com> writes:

> Yet I'm afraid it could be:
> 1. expensive to rewrite all commit log (reallocating the buffer)
> 2. Inappropriate to change the value in function that is supposed to
> read

In my suggestion I avoided rewriting the log buffer, primarily
because of #2 (in addition to "read" cleanliness, such a change may
break the gpg signature checking for merges).

We do reencode the contents before we write it out when "encoding"
is present, so logically such a rewrite of authors and committers
belongs to where that happens, in pretty_print_commit().  Note that
this existing rewrite is not done to the commit log buffer but is to
a separate buffer meant to be used only for output.

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

* Re: Use of a mailmap file with git-log
  2012-12-10 19:47   ` Antoine Pelisse
  2012-12-10 20:05     ` Junio C Hamano
@ 2012-12-10 20:16     ` Junio C Hamano
  1 sibling, 0 replies; 6+ messages in thread
From: Junio C Hamano @ 2012-12-10 20:16 UTC (permalink / raw)
  To: Antoine Pelisse; +Cc: Rich Midwinter, git

Antoine Pelisse <apelisse@gmail.com> writes:

> It could indeed be very interesting to have mailmap applied to git-log and
> especially to git-log --author/--committer.
> ...
> The choice of parse_commit_buffer to do the modification is due to
> the grepping being done directly on buffer when grepping author/committerer.

For pattern matching, I think revision.c::commit_match() is probably
the right place to do this kind of thing.  I just noticed that we
grep for the string inside a raw buffer, even when "encoding" is
specified, which I think is a bug.

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

end of thread, other threads:[~2012-12-10 20:16 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-12-10 18:22 Use of a mailmap file with git-log Rich Midwinter
2012-12-10 18:48 ` Junio C Hamano
2012-12-10 19:43   ` Junio C Hamano
2012-12-10 19:47   ` Antoine Pelisse
2012-12-10 20:05     ` Junio C Hamano
2012-12-10 20:16     ` 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).