git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Bryan Turner <bturner@atlassian.com>, SURA <surak8806@gmail.com>,
	Git Users <git@vger.kernel.org>
Subject: Re: [PATCH] mailmap: only look for .mailmap in work tree
Date: Wed, 10 Feb 2021 12:10:02 -0800	[thread overview]
Message-ID: <xmqqblcr3crp.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <YCQGqeHB4rXi6dG0@coredump.intra.peff.net> (Jeff King's message of "Wed, 10 Feb 2021 11:15:37 -0500")

Jeff King <peff@peff.net> writes:

> On Tue, Feb 09, 2021 at 01:23:32PM -0800, Junio C Hamano wrote:
>
>> Jeff King <peff@peff.net> writes:
>> 
>> >   If the file `.mailmap` exists at the toplevel of the repository[...]
>> >
>> > which likewise reinforces the notion that we are looking in the working
>> > tree.
>> 
>> > diff --git a/mailmap.c b/mailmap.c
>> > index eb77c6e77c..9bb9cf8b30 100644
>> > --- a/mailmap.c
>> > +++ b/mailmap.c
>> > @@ -225,7 +225,8 @@ int read_mailmap(struct string_list *map)
>> >  	if (!git_mailmap_blob && is_bare_repository())
>> >  		git_mailmap_blob = "HEAD:.mailmap";
>> >  
>> > -	err |= read_mailmap_file(map, ".mailmap");
>> > +	if (!startup_info->have_repository || !is_bare_repository())
>> > +		err |= read_mailmap_file(map, ".mailmap");
>> 
>> OK.  Do we know at this point that cwd is always/already at the root
>> level of the working tree?
>
> I think so. If we're in a non-bare repository, we'd have chdir'd during
> the setup/discovery steps. At any rate, this patch could not possibly be
> making such a situation _worse_, as we were previously reading it
> unconditionally.

But the point of the patch is to ensure that we only read from the
top of the working tree---I wanted to make sure that we previously
weren't reading it from any subdirectory the command started.

> If you are proposing that this become:
> ...

Not really.  As long as we know we would already have moved to the
top, then what we have above is perfectly fine.

> .... I suspect it may even be necessary to use a mailmap in
> an in-process submodule repository (in which case we should be taking a
> "struct repository" argument and checking it in the first two branches
> of the conditional). But this is orthogonal to what my patch is doing, I
> think. And I'd rather punt on it until there is a known upside (probably
> as part of a larger effort to allow mailmaps outside of the_repository).

Yeah, I was not interested in what happens with in-process
submodule, and I'd rather leave the code as close to as-is, until it
becomes necessary to update it.

Thanks.

  reply	other threads:[~2021-02-10 20:11 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-02-01  3:05 I've noticed the command `git --git-dir=<path> shortlog` SURA
2021-02-05 16:57 ` Jeff King
2021-02-05 20:02   ` Bryan Turner
2021-02-09 17:29     ` [PATCH] mailmap: only look for .mailmap in work tree Jeff King
2021-02-09 19:00       ` Eric Sunshine
2021-02-09 22:16         ` Junio C Hamano
2021-02-10 16:05         ` Jeff King
2021-02-09 21:23       ` Junio C Hamano
2021-02-10 16:15         ` Jeff King
2021-02-10 20:10           ` Junio C Hamano [this message]
2021-02-10 20:31             ` Jeff King
2021-02-10 20:34               ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqblcr3crp.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=bturner@atlassian.com \
    --cc=git@vger.kernel.org \
    --cc=peff@peff.net \
    --cc=surak8806@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).