git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Derrick Stolee <stolee@gmail.com>
To: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>, git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
	William Hubbs <williamh@gentoo.org>,
	chutzpah@gentoo.org
Subject: Re: [PATCH v6 2/2] config: allow giving separate author and committer idents
Date: Mon, 15 Apr 2019 10:24:04 -0400	[thread overview]
Message-ID: <15f17152-fcec-ee9a-acd3-f36cf2c98030@gmail.com> (raw)
In-Reply-To: <20190205195212.25550-3-avarab@gmail.com>

On 2/5/2019 2:52 PM, Ævar Arnfjörð Bjarmason wrote:
> From: William Hubbs <williamh@gentoo.org>
> -const char *fmt_name(const char *name, const char *email)
> +const char *fmt_name(enum want_ident whose_ident)
>  {
> -	return fmt_ident(name, email, NULL, IDENT_STRICT | IDENT_NO_DATE);
> +	char *name = NULL;
> +	char *email = NULL;
> +
> +	switch (whose_ident) {
> +	case WANT_BLANK_IDENT:
> +		break;
> +	case WANT_AUTHOR_IDENT:
> +		name = getenv("GIT_AUTHOR_NAME");
> +		email = getenv("GIT_AUTHOR_EMAIL");
> +		break;
> +	case WANT_COMMITTER_IDENT:
> +		name = getenv("GIT_COMMITTER_NAME");
> +		email = getenv("GIT_COMMITTER_EMAIL");
> +		break;
> +	}
> +	return fmt_ident(name, email, whose_ident, NULL,
> +			IDENT_STRICT | IDENT_NO_DATE);
>  }

William and Ævar,

The "WANT_AUTHOR_IDENT" block of this switch statement does not
appear to be hit by any tests, despite the tests included in this
patch. My guess is that it is ignored because we have the following
code in builtin/commit.c:

static void determine_author_info(struct strbuf *author_ident)
{
	char *name, *email, *date;
	struct ident_split author;

	name = xstrdup_or_null(getenv("GIT_AUTHOR_NAME"));
	email = xstrdup_or_null(getenv("GIT_AUTHOR_EMAIL"));
	date = xstrdup_or_null(getenv("GIT_AUTHOR_DATE"));
...


This is likely overriding the need to use fmt_name. Should we
de-duplicate this use of the environment variable by using your
new method at this spot in builtin/commit.c?

Thanks,
-Stolee

      parent reply	other threads:[~2019-04-15 14:24 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-04 18:48 [PATCH v5 0/1] config: allow giving separate author and committer William Hubbs
2019-02-04 18:48 ` [PATCH v5 1/1] config: allow giving separate author and committer idents William Hubbs
2019-02-05  9:16   ` Johannes Schindelin
2019-02-05 18:02     ` Junio C Hamano
2019-02-05 19:52 ` [PATCH v6 0/2] New {author,committer}.{name,email} config Ævar Arnfjörð Bjarmason
2019-02-05 19:52 ` [PATCH v6 1/2] ident: test how GIT_* and user.{name,email} interact Ævar Arnfjörð Bjarmason
2019-02-05 19:52 ` [PATCH v6 2/2] config: allow giving separate author and committer idents Ævar Arnfjörð Bjarmason
2019-02-05 20:22   ` Junio C Hamano
2019-02-05 21:14     ` Ævar Arnfjörð Bjarmason
2019-02-06  0:04       ` William Hubbs
2019-02-06  0:15         ` William Hubbs
2019-02-06  1:05           ` William Hubbs
2019-02-06  5:03         ` Junio C Hamano
2019-02-13 16:43           ` William Hubbs
2019-02-13 22:37             ` Junio C Hamano
2019-02-14 18:17               ` William Hubbs
2019-02-06  8:58         ` Ævar Arnfjörð Bjarmason
2019-02-06  9:28       ` Ævar Arnfjörð Bjarmason
2019-02-06 18:26         ` Jeff King
2019-02-06 18:41           ` William Hubbs
2019-02-06 22:43           ` Junio C Hamano
2019-02-06 18:34         ` William Hubbs
2019-04-15 14:24   ` Derrick Stolee [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=15f17152-fcec-ee9a-acd3-f36cf2c98030@gmail.com \
    --to=stolee@gmail.com \
    --cc=avarab@gmail.com \
    --cc=chutzpah@gentoo.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=williamh@gentoo.org \
    /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).