MCPcopy Create free account
hub / github.com/git/git / set_ident

Function set_ident

ident.c:610–675  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

608}
609
610static int set_ident(const char *var, const char *value)
611{
612 if (!strcmp(var, "author.name")) {
613 if (!value)
614 return config_error_nonbool(var);
615 strbuf_reset(&git_author_name);
616 strbuf_addstr(&git_author_name, value);
617 author_ident_explicitly_given |= IDENT_NAME_GIVEN;
618 ident_config_given |= IDENT_NAME_GIVEN;
619 return 0;
620 }
621
622 if (!strcmp(var, "author.email")) {
623 if (!value)
624 return config_error_nonbool(var);
625 strbuf_reset(&git_author_email);
626 strbuf_addstr(&git_author_email, value);
627 author_ident_explicitly_given |= IDENT_MAIL_GIVEN;
628 ident_config_given |= IDENT_MAIL_GIVEN;
629 return 0;
630 }
631
632 if (!strcmp(var, "committer.name")) {
633 if (!value)
634 return config_error_nonbool(var);
635 strbuf_reset(&git_committer_name);
636 strbuf_addstr(&git_committer_name, value);
637 committer_ident_explicitly_given |= IDENT_NAME_GIVEN;
638 ident_config_given |= IDENT_NAME_GIVEN;
639 return 0;
640 }
641
642 if (!strcmp(var, "committer.email")) {
643 if (!value)
644 return config_error_nonbool(var);
645 strbuf_reset(&git_committer_email);
646 strbuf_addstr(&git_committer_email, value);
647 committer_ident_explicitly_given |= IDENT_MAIL_GIVEN;
648 ident_config_given |= IDENT_MAIL_GIVEN;
649 return 0;
650 }
651
652 if (!strcmp(var, "user.name")) {
653 if (!value)
654 return config_error_nonbool(var);
655 strbuf_reset(&git_default_name);
656 strbuf_addstr(&git_default_name, value);
657 committer_ident_explicitly_given |= IDENT_NAME_GIVEN;
658 author_ident_explicitly_given |= IDENT_NAME_GIVEN;
659 ident_config_given |= IDENT_NAME_GIVEN;
660 return 0;
661 }
662
663 if (!strcmp(var, "user.email")) {
664 if (!value)
665 return config_error_nonbool(var);
666 strbuf_reset(&git_default_email);
667 strbuf_addstr(&git_default_email, value);

Callers 1

git_ident_configFunction · 0.85

Calls 2

config_error_nonboolFunction · 0.85
strbuf_addstrFunction · 0.85

Tested by

no test coverage detected