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

Function read_convert_config

convert.c:1024–1078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1022}
1023
1024static int read_convert_config(const char *var, const char *value,
1025 const struct config_context *ctx UNUSED,
1026 void *cb UNUSED)
1027{
1028 const char *key, *name;
1029 size_t namelen;
1030 struct convert_driver *drv;
1031
1032 /*
1033 * External conversion drivers are configured using
1034 * "filter.<name>.variable".
1035 */
1036 if (parse_config_key(var, "filter", &name, &namelen, &key) < 0 || !name)
1037 return 0;
1038 for (drv = user_convert; drv; drv = drv->next)
1039 if (!xstrncmpz(drv->name, name, namelen))
1040 break;
1041 if (!drv) {
1042 CALLOC_ARRAY(drv, 1);
1043 drv->name = xmemdupz(name, namelen);
1044 *user_convert_tail = drv;
1045 user_convert_tail = &(drv->next);
1046 }
1047
1048 /*
1049 * filter.<name>.smudge and filter.<name>.clean specifies
1050 * the command line:
1051 *
1052 * command-line
1053 *
1054 * The command-line will not be interpolated in any way.
1055 */
1056
1057 if (!strcmp("smudge", key)) {
1058 FREE_AND_NULL(drv->smudge);
1059 return git_config_string(&drv->smudge, var, value);
1060 }
1061
1062 if (!strcmp("clean", key)) {
1063 FREE_AND_NULL(drv->clean);
1064 return git_config_string(&drv->clean, var, value);
1065 }
1066
1067 if (!strcmp("process", key)) {
1068 FREE_AND_NULL(drv->process);
1069 return git_config_string(&drv->process, var, value);
1070 }
1071
1072 if (!strcmp("required", key)) {
1073 drv->required = git_config_bool(var, value);
1074 return 0;
1075 }
1076
1077 return 0;
1078}
1079
1080static int count_ident(const char *cp, unsigned long size)
1081{

Callers

nothing calls this directly

Calls 5

parse_config_keyFunction · 0.85
xstrncmpzFunction · 0.85
xmemdupzFunction · 0.85
git_config_stringFunction · 0.85
git_config_boolFunction · 0.85

Tested by

no test coverage detected