git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
Cc: git@vger.kernel.org, levraiphilippeblain@gmail.com
Subject: Re: [PATCHv2] imap-send: parse default git config
Date: Mon, 30 Nov 2020 15:33:14 -0800	[thread overview]
Message-ID: <xmqqk0u2to79.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: 1c3954a4-a8c7-d134-1a4a-aee8c3b4ef24@suse.com

Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com> writes:

> git imap-send does not parse the default git config settings and thus ignore
> core.askpass value.
> Rewrite config parsing to support core settings.
>
> Reported-by: Philippe Blain <levraiphilippeblain@gmail.com>
> Signed-off-by: Nicolas Morey-Chaisemartin <nmoreychaisemartin@suse.com>
> ---
>  imap-send.c | 52 ++++++++++++++++++++++++++++++----------------------
>  1 file changed, 30 insertions(+), 22 deletions(-)
>
> diff --git a/imap-send.c b/imap-send.c
> index 5764dd812ca7..fa1921734671 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -84,17 +84,17 @@ static int nfvasprintf(char **strp, const char *fmt, va_list ap)
>  }
>    struct imap_server_conf {
> -	char *name;
> -	char *tunnel;
> -	char *host;
> +	const char *name;
> +	const char *tunnel;
> +	const char *host;
>  	int port;
> -	char *folder;
> -	char *user;
> -	char *pass;
> +	const char *folder;
> +	const char *user;
> +	const char *pass;
>  	int use_ssl;
>  	int ssl_verify;
>  	int use_html;
> -	char *auth_method;
> +	const char *auth_method;

Nice to see these tightened up, I guess.

> @@ -955,7 +955,7 @@ static void server_fill_credential(struct imap_server_conf *srvc, struct credent
>  		srvc->pass = xstrdup(cred->password);
>  }
>  -static struct imap_store *imap_open_store(struct imap_server_conf
>  *srvc, char *folder)
> +static struct imap_store *imap_open_store(struct imap_server_conf *srvc, const char *folder)

Sorry but it appears that

    Content-Type: text/plain; charset=windows-1252; format=flowed

munged the message into an unusable shape (the "flowed" part is what
makes it unusable), so it cannot be applied X-<.

>  {
>  	struct credential cred = CREDENTIAL_INIT;
>  	struct imap_store *ctx;
> @@ -1338,15 +1338,26 @@ static int split_msg(struct strbuf *all_msgs, struct strbuf *msg, int *ofs)
>  	return 1;
>  }
>  -static void git_imap_config(void)
> +static int git_imap_config(const char *var, const char *val, void *cb)
>  {
> -	const char *val = NULL;
>  -	git_config_get_bool("imap.sslverify", &server.ssl_verify);
> -	git_config_get_bool("imap.preformattedhtml", &server.use_html);
> -	git_config_get_string("imap.folder", &server.folder);
> -
> -	if (!git_config_get_value("imap.host", &val)) {
> +	if(!strcmp("imap.sslverify", var))
> +		server.ssl_verify = git_config_bool(var, val);
> +	else if(!strcmp("imap.preformattedhtml", var))
> +		server.use_html = git_config_bool(var, val);

Style: a SP between "if" and "(".

> +	else if(!strcmp("imap.folder", var))
> +		return git_config_string(&server.folder, var, val);

Other than that, the patch looks quite straight-forward.

Thanks.

      reply	other threads:[~2020-11-30 23:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26  8:37 [PATCHv2] imap-send: parse default git config Nicolas Morey-Chaisemartin
2020-11-30 23:33 ` Junio C Hamano [this message]

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=xmqqk0u2to79.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=levraiphilippeblain@gmail.com \
    --cc=nmoreychaisemartin@suse.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).