| 1137 | }; |
| 1138 | |
| 1139 | static int fsck_gitmodules_fn(const char *var, const char *value, |
| 1140 | const struct config_context *ctx UNUSED, |
| 1141 | void *vdata) |
| 1142 | { |
| 1143 | struct fsck_gitmodules_data *data = vdata; |
| 1144 | const char *subsection, *key; |
| 1145 | size_t subsection_len; |
| 1146 | char *name; |
| 1147 | |
| 1148 | if (parse_config_key(var, "submodule", &subsection, &subsection_len, &key) < 0 || |
| 1149 | !subsection) |
| 1150 | return 0; |
| 1151 | |
| 1152 | name = xmemdupz(subsection, subsection_len); |
| 1153 | if (check_submodule_name(name) < 0) |
| 1154 | data->ret |= report(data->options, |
| 1155 | data->oid, OBJ_BLOB, |
| 1156 | FSCK_MSG_GITMODULES_NAME, |
| 1157 | "disallowed submodule name: %s", |
| 1158 | name); |
| 1159 | if (!strcmp(key, "url") && value && |
| 1160 | check_submodule_url(value) < 0) |
| 1161 | data->ret |= report(data->options, |
| 1162 | data->oid, OBJ_BLOB, |
| 1163 | FSCK_MSG_GITMODULES_URL, |
| 1164 | "disallowed submodule url: %s", |
| 1165 | value); |
| 1166 | if (!strcmp(key, "path") && value && |
| 1167 | looks_like_command_line_option(value)) |
| 1168 | data->ret |= report(data->options, |
| 1169 | data->oid, OBJ_BLOB, |
| 1170 | FSCK_MSG_GITMODULES_PATH, |
| 1171 | "disallowed submodule path: %s", |
| 1172 | value); |
| 1173 | if (!strcmp(key, "update") && value && |
| 1174 | parse_submodule_update_type(value) == SM_UPDATE_COMMAND) |
| 1175 | data->ret |= report(data->options, data->oid, OBJ_BLOB, |
| 1176 | FSCK_MSG_GITMODULES_UPDATE, |
| 1177 | "disallowed submodule update setting: %s", |
| 1178 | value); |
| 1179 | free(name); |
| 1180 | |
| 1181 | return 0; |
| 1182 | } |
| 1183 | |
| 1184 | static int fsck_blob(const struct object_id *oid, const char *buf, |
| 1185 | unsigned long size, struct fsck_options *options) |
nothing calls this directly
no test coverage detected