git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, levraiphilippeblain@gmail.com
Subject: Re: [PATCH] imap-send: parse default git config
Date: Wed, 25 Nov 2020 09:43:01 +0100	[thread overview]
Message-ID: <9c410f99-6b9f-3d94-bd4c-8e4197b3cde3@suse.com> (raw)
In-Reply-To: <xmqqh7pdg7ma.fsf@gitster.c.googlers.com>



On 11/25/20 9:31 AM, Junio C Hamano wrote:
> Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com> writes:
> 
>> git imap-send does not parse the default git config settings and thus ignore
>> core.askpass value.
>> Fix it by calling git_config(git_default_config)
>>
>> Reported-by: Philippe Blain <levraiphilippeblain@gmail.com>
>> Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
>> ---
>>   imap-send.c | 1 +
>>   1 file changed, 1 insertion(+)
>>
>> diff --git a/imap-send.c b/imap-send.c
>> index 5764dd812ca7..790780b76da2 100644
>> --- a/imap-send.c
>> +++ b/imap-send.c
>> @@ -1367,6 +1367,7 @@ static void git_imap_config(void)
>>   	git_config_get_int("imap.port", &server.port);
>>   	git_config_get_string("imap.tunnel", &server.tunnel);
>>   	git_config_get_string("imap.authmethod", &server.auth_method);
>> +	git_config(git_default_config, NULL);
> 
> There are two styles of parsing configuration variables to get
> values.  The way imap-send.c works is to grab individual values by
> calling git_config_get_*() functions.  The other is to give a
> callback function to git_config() to iterate over all configuration
> variables and pick the relevant ones.
> 

OK. I thought it wouldn't be THAT easy :)


> Of course you could also unify in the other direction and instead of
> running git_config(git_defauilt_config, NULL), pick the exact
> variables you care about (did you say askpass???).

The only one we care about for this specific case if core.askpass as user gets prompted to authenticate on his IMAP server.
So picking just this one would be simpler. However isn't the other way around cleaner if we happen to depend on another "generic/core" setting ?

Nicolas


  reply	other threads:[~2020-11-25  8:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-24 15:20 [BUG] git imap-send does not honor 'core.askpass' Philippe Blain
2020-11-25  8:05 ` [PATCH] imap-send: parse default git config Nicolas Morey-Chaisemartin
2020-11-25  8:31   ` Junio C Hamano
2020-11-25  8:43     ` Nicolas Morey-Chaisemartin [this message]
2020-11-25 19:18       ` Junio C Hamano

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=9c410f99-6b9f-3d94-bd4c-8e4197b3cde3@suse.com \
    --to=nmoreychaisemartin@suse.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=levraiphilippeblain@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).