MCPcopy Index your code
hub / github.com/git/git / git_gpg_config

Function git_gpg_config

gpg-interface.c:738–811  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

736}
737
738static int git_gpg_config(const char *var, const char *value,
739 const struct config_context *ctx UNUSED,
740 void *cb UNUSED)
741{
742 struct gpg_format *fmt = NULL;
743 const char *fmtname = NULL;
744 char *trust;
745 int ret;
746
747 if (!strcmp(var, "user.signingkey")) {
748 if (!value)
749 return config_error_nonbool(var);
750 set_signing_key(value);
751 return 0;
752 }
753
754 if (!strcmp(var, "gpg.format")) {
755 if (!value)
756 return config_error_nonbool(var);
757 fmt = get_format_by_name(value);
758 if (!fmt)
759 return error(_("invalid value for '%s': '%s'"),
760 var, value);
761 use_format = fmt;
762 return 0;
763 }
764
765 if (!strcmp(var, "gpg.mintrustlevel")) {
766 if (!value)
767 return config_error_nonbool(var);
768
769 trust = xstrdup_toupper(value);
770 ret = parse_gpg_trust_level(trust, &configured_min_trust_level);
771 free(trust);
772
773 if (ret)
774 return error(_("invalid value for '%s': '%s'"),
775 var, value);
776 return 0;
777 }
778
779 if (!strcmp(var, "gpg.ssh.defaultkeycommand"))
780 return git_config_string(&ssh_default_key_command, var, value);
781
782 if (!strcmp(var, "gpg.ssh.allowedsignersfile"))
783 return git_config_pathname(&ssh_allowed_signers, var, value);
784
785 if (!strcmp(var, "gpg.ssh.revocationfile"))
786 return git_config_pathname(&ssh_revocation_file, var, value);
787
788 if (!strcmp(var, "gpg.program") || !strcmp(var, "gpg.openpgp.program"))
789 fmtname = "openpgp";
790
791 if (!strcmp(var, "gpg.x509.program"))
792 fmtname = "x509";
793
794 if (!strcmp(var, "gpg.ssh.program"))
795 fmtname = "ssh";

Callers

nothing calls this directly

Calls 8

config_error_nonboolFunction · 0.85
set_signing_keyFunction · 0.85
get_format_by_nameFunction · 0.85
errorFunction · 0.85
xstrdup_toupperFunction · 0.85
parse_gpg_trust_levelFunction · 0.85
git_config_stringFunction · 0.85
git_config_pathnameFunction · 0.85

Tested by

no test coverage detected