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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 25, 2019 at 11:58:10PM +0100, Ævar Arnfjörð Bjarmason wrote:
> 
> On Fri, Jan 25 2019, William Hubbs wrote:
> 
> > @@ -480,6 +515,46 @@ int git_ident_config(const char *var, const char *value, void *data)
> >  		return 0;
> >  	}
> >
> > +	if (!strcmp(var, "author.name")) {
> > +		if (!value)
> > +			return config_error_nonbool(var);
> > +		strbuf_reset(&git_author_name);
> > +		strbuf_addstr(&git_author_name, value);
> > +		author_ident_explicitly_given |= IDENT_NAME_GIVEN;
> > +		ident_config_given |= IDENT_NAME_GIVEN;
> > +		return 0;
> > +	}
> > +
> > +	if (!strcmp(var, "author.email")) {
> > +		if (!value)
> > +			return config_error_nonbool(var);
> > +		strbuf_reset(&git_author_email);
> > +		strbuf_addstr(&git_author_email, value);
> > +		author_ident_explicitly_given |= IDENT_MAIL_GIVEN;
> > +		ident_config_given |= IDENT_MAIL_GIVEN;
> > +		return 0;
> > +	}
> > +
> > +	if (!strcmp(var, "committer.name")) {
> > +		if (!value)
> > +			return config_error_nonbool(var);
> > +		strbuf_reset(&git_committer_name);
> > +		strbuf_addstr(&git_committer_name, value);
> > +		committer_ident_explicitly_given |= IDENT_NAME_GIVEN;
> > +		ident_config_given |= IDENT_NAME_GIVEN;
> > +		return 0;
> > +	}
> > +
> > +	if (!strcmp(var, "committer.email")) {
> > +		if (!value)
> > +			return config_error_nonbool(var);
> > +		strbuf_reset(&git_committer_email);
> > +		strbuf_addstr(&git_committer_email, value);
> > +		committer_ident_explicitly_given |= IDENT_MAIL_GIVEN;
> > +		ident_config_given |= IDENT_MAIL_GIVEN;
> > +		return 0;
> > +	}
> > +
> 
> This whole thing should be split into a static function. It's the same
> code copy/pasted 4x times just with a differnet value for "var", the
> strbuf variable & IDENT_*_GIVEN.

I have moved most of this into a separate function in the next version
of the patch. However, I do not see a way to factor it down further. Let
me know what you think when I resend.

Also, if you see anything  longer than 79 characters, please let me know
where the long lines are and I have no problem reformatting them.

Thanks much.

William




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux