From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, William Hubbs <williamh@gentoo.org>,
chutzpah@gentoo.org
Subject: Re: [PATCH v6 2/2] config: allow giving separate author and committer idents
Date: Tue, 05 Feb 2019 22:14:37 +0100 [thread overview]
Message-ID: <87k1iekkea.fsf@evledraar.gmail.com> (raw)
In-Reply-To: <xmqqef8mrnnj.fsf@gitster-ct.c.googlers.com>
On Tue, Feb 05 2019, Junio C Hamano wrote:
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> +static int set_ident_internal(const char *var, const char *value,
>> + struct strbuf *sb, const int flag)
>> +{
>> + if (!value)
>> + return config_error_nonbool(var);
>> + strbuf_reset(sb);
>> + strbuf_addstr(sb, value);
>> + author_ident_explicitly_given |= flag;
>> + ident_config_given |= flag;
>> + return 0;
>> +}
>> +
>> +static int set_ident(const char *var, const char *value)
>> +{
>> + if (!strcmp(var, "author.name"))
>> + return set_ident_internal(var, value, &git_author_name,
>> + IDENT_NAME_GIVEN);
>> + else if (!strcmp(var, "author.email"))
>> + return set_ident_internal(var, value, &git_author_email,
>> + IDENT_MAIL_GIVEN);
>> + else if (!strcmp(var, "committer.name"))
>> + return set_ident_internal(var, value, &git_committer_name,
>> + IDENT_NAME_GIVEN);
>> + else if (!strcmp(var, "committer.email"))
>> + return set_ident_internal(var, value, &git_committer_email,
>> + IDENT_MAIL_GIVEN);
>> + else if (!strcmp(var, "user.name"))
>> + return set_ident_internal(var, value, &git_default_name,
>> + IDENT_NAME_GIVEN);
>> + else if (!strcmp(var, "user.email"))
>> + return set_ident_internal(var, value, &git_default_email,
>> + IDENT_MAIL_GIVEN);
>> + return 0;
>> +}
>
> In the v5 patch from William, author_ident_explicitly_given and
> committer_ident_explicitly_given were set separately depending on
> what variable was given (e.g. user.name marked both, author.name
> marked only author but not committer_ident_explicitly_given). In
> the original before the addition of this feature with v6, giving
> user.name would have set both, as we can see below.
>
> Is this change intended?
>
> Or did you find that committer_ident_explicitly_given is no longer
> useful and the variable is not used anymore?
No, that's a mistake of mine when porting this over, but also clearly a
blindspot in our tests since they all pass with this.
I haven't dug (don't have time right now) to check what the effect of
that is. William?
>> int git_ident_config(const char *var, const char *value, void *data)
>> {
>> if (!strcmp(var, "user.useconfigonly")) {
>> @@ -480,29 +551,7 @@ int git_ident_config(const char *var, const char *value, void *data)
>> return 0;
>> }
>>
>> - if (!strcmp(var, "user.name")) {
>> - if (!value)
>> - return config_error_nonbool(var);
>> - strbuf_reset(&git_default_name);
>> - strbuf_addstr(&git_default_name, value);
>> - committer_ident_explicitly_given |= IDENT_NAME_GIVEN;
>> - author_ident_explicitly_given |= IDENT_NAME_GIVEN;
>> - ident_config_given |= IDENT_NAME_GIVEN;
>> - return 0;
>> - }
>> -
>> - if (!strcmp(var, "user.email")) {
>> - if (!value)
>> - return config_error_nonbool(var);
>> - strbuf_reset(&git_default_email);
>> - strbuf_addstr(&git_default_email, value);
>> - committer_ident_explicitly_given |= IDENT_MAIL_GIVEN;
>> - author_ident_explicitly_given |= IDENT_MAIL_GIVEN;
>> - ident_config_given |= IDENT_MAIL_GIVEN;
>> - return 0;
>> - }
>> -
>> - return 0;
>> + return set_ident(var, value);
>> }
next prev parent reply other threads:[~2019-02-05 21:14 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 [this message]
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
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=87k1iekkea.fsf@evledraar.gmail.com \
--to=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).