git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] gitweb: map names/emails with mailmap

From
Eric Sunshine <sunshine@sunshineco.com>
Date
Aug 10, 2020, 05:41 UTC
Message-ID
<CAPig+cT2dFLHp6YhUmD7SeGBy3u1mQMhTTCefRzSfz3sTC0OhA@mail.gmail.com>
In-Reply-To
<20200810031123.GA3565@pluvano.com>
On Sun, Aug 9, 2020 at 11:12 PM Emma Brooks <me@pluvano.com> wrote:
Show 10 quoted lines
> On 2020-08-09 20:49:59-0400, Eric Sunshine wrote:
> > On Sun, Aug 9, 2020 at 7:06 PM Emma Brooks <me@pluvano.com> wrote:
> > > +mailmap::
> >
> > Is this setting global or per-repository? (I ask because documentation
> > for other options in this section document whether they can be set
> > per-repository.)
>
> Global. I'll add a note that it cannot be set per-project, or I could
> add support for setting it per-project if that's wanted.

If it's not much extra work, it might make sense to support per-project, if for no other reason, to be consistent with other nearby options.

Show 5 quoted lines
> > Should there be any sort of support for functionality similar to the
> > "mailmap.file" and "mailmap.blob" configuration options in Git itself?
> > (Genuine question, not a demand for you to implement such support.)
>
> Yes, that would be useful and should probably be supported.

I don't insist upon it. It can always be added later if someone needs it. I was asking about it now because it might have an affect on the design or type of value which the 'mailmap' option you added above can accept, and I was concerned about getting locked into a design without taking these other possibilities into account. For instance, rather than being a simple boolean, perhaps the 'mailmap' option you added could be more expressive, eventually allowing support for an explicit file or blob. This is another reason why I asked if 'mailmap' can be per-project, since an explicit mailmap file, and especially a blob, would belong to a particular project. It's just something to think about. (Then again, I'm not a gitweb user, nor am I familiar with its configuration, so take my observations with a grain of salt.)

Show 11 quoted lines
> > > +       open my $fd, '-|', quote_command(
> > > +               git_cmd(), 'cat-file', 'blob', 'HEAD:.mailmap') . ' 2> /dev/null'
> > > +               or die_error(500, 'Failed to read mailmap');
> >
> > Am I reading this correctly that this will die if the project does not
> > have a .mailmap file? If so, that seems like harsh behavior since
> > there are many projects in the wild lacking a .mailmap file.
>
> No, this error message is misleading. The die_error is called if there
> is a problem executing git cat-file, but not if cat-file returns an
> error. I'll revise this message to be more accurate.
Okay, that makes sense.
Show 13 quoted lines
> > > +       return \%mailmap if eof $fd;
> > > +       foreach (split '\n', <$fd>) {
> >
> > If the .mailmap has no content, then the 'foreach' loop won't be
> > entered, which means the early 'return' above it is unneeded, correct?
> > (Not necessarily asking for the early 'return' to be removed, but more
> > a case of checking that I'm understanding the logic.)
>
> The early return is intended to catch when there is no mailmap, so $fd
> does not get initialized. Without it, you would get an error when you
> try to split $fd's content:
>
>     Use of uninitialized value $fd in split at [the foreach]

Right. This follows from my misunderstanding what happened if .mailmap was missing.

Previous: Emma BrooksNext: Jeff King
Message 9 of 18 in “gitweb: Map names/emails with mailmap”
  1. gitweb: Map names/emails with mailmapEmma Brooks, Jul 30, 2020
  2. Junio C HamanoJul 30, 2020
  3. Jeff KingJul 31, 2020
  4. Junio C HamanoJul 31, 2020
  5. gitweb: Map names/emails with mailmapEmma Brooks, Aug 8, 2020
  6. gitweb: map names/emails with mailmapEmma Brooks, Aug 9, 2020
  7. Eric SunshineAug 10, 2020
  8. Emma BrooksAug 10, 2020
  9. Eric SunshineAug 10, 2020
  10. Jeff KingAug 10, 2020
  11. Emma BrooksAug 11, 2020
  12. Eric SunshineAug 11, 2020
  13. Jeff KingAug 11, 2020
  14. Emma BrooksSep 5, 2020
  15. Junio C HamanoSep 5, 2020
  16. Emma BrooksSep 7, 2020
  17. Eric WongAug 11, 2020
  18. Joe PerchesAug 11, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.