git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v6 2/2] config: allow giving separate author and committer idents

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Feb 5, 2019, 21:14 UTC
Message-ID
<87k1iekkea.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqef8mrnnj.fsf@gitster-ct.c.googlers.com>
On Tue, Feb 05 2019, Junio C Hamano wrote:
Show 48 quoted lines
> Æ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?

Show 32 quoted lines
>>  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);
>>  }
Previous: Junio C HamanoNext: William Hubbs
Message 9 of 23 in “config: allow giving separate author and committer”
  1. 0/1 config: allow giving separate author and committerWilliam Hubbs, Feb 4, 2019
  2. 1/1 config: allow giving separate author and committer identsWilliam Hubbs, Feb 4, 2019
  3. Johannes SchindelinFeb 5, 2019
  4. Junio C HamanoFeb 5, 2019
  5. 0/2 New {author,committer}.{name,email} configÆvar Arnfjörð Bjarmason, Feb 5, 2019
  6. 1/2 ident: test how GIT_* and user.{name,email} interactÆvar Arnfjörð Bjarmason, Feb 5, 2019
  7. 2/2 config: allow giving separate author and committer identsÆvar Arnfjörð Bjarmason, Feb 5, 2019
  8. Junio C HamanoFeb 5, 2019
  9. Ævar Arnfjörð BjarmasonFeb 5, 2019
  10. William HubbsFeb 6, 2019
  11. William HubbsFeb 6, 2019
  12. William HubbsFeb 6, 2019
  13. Junio C HamanoFeb 6, 2019
  14. William HubbsFeb 13, 2019
  15. Junio C HamanoFeb 13, 2019
  16. William HubbsFeb 14, 2019
  17. Ævar Arnfjörð BjarmasonFeb 6, 2019
  18. Ævar Arnfjörð BjarmasonFeb 6, 2019
  19. Jeff KingFeb 6, 2019
  20. William HubbsFeb 6, 2019
  21. Junio C HamanoFeb 6, 2019
  22. William HubbsFeb 6, 2019
  23. Derrick StoleeApr 15, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.