| 1379 | } |
| 1380 | |
| 1381 | void fsck_options_init(struct fsck_options *options, |
| 1382 | struct repository *repo, |
| 1383 | enum fsck_options_type type) |
| 1384 | { |
| 1385 | static const struct fsck_options defaults[] = { |
| 1386 | [FSCK_OPTIONS_DEFAULT] = { |
| 1387 | .skip_oids = OIDSET_INIT, |
| 1388 | .gitmodules_found = OIDSET_INIT, |
| 1389 | .gitmodules_done = OIDSET_INIT, |
| 1390 | .gitattributes_found = OIDSET_INIT, |
| 1391 | .gitattributes_done = OIDSET_INIT, |
| 1392 | .error_func = fsck_objects_error_function |
| 1393 | }, |
| 1394 | [FSCK_OPTIONS_STRICT] = { |
| 1395 | .strict = 1, |
| 1396 | .gitmodules_found = OIDSET_INIT, |
| 1397 | .gitmodules_done = OIDSET_INIT, |
| 1398 | .gitattributes_found = OIDSET_INIT, |
| 1399 | .gitattributes_done = OIDSET_INIT, |
| 1400 | .error_func = fsck_objects_error_function, |
| 1401 | }, |
| 1402 | [FSCK_OPTIONS_MISSING_GITMODULES] = { |
| 1403 | .strict = 1, |
| 1404 | .gitmodules_found = OIDSET_INIT, |
| 1405 | .gitmodules_done = OIDSET_INIT, |
| 1406 | .gitattributes_found = OIDSET_INIT, |
| 1407 | .gitattributes_done = OIDSET_INIT, |
| 1408 | .error_func = fsck_objects_error_cb_print_missing_gitmodules, |
| 1409 | }, |
| 1410 | [FSCK_OPTIONS_REFS] = { |
| 1411 | .error_func = fsck_refs_error_function, |
| 1412 | }, |
| 1413 | }; |
| 1414 | |
| 1415 | switch (type) { |
| 1416 | case FSCK_OPTIONS_DEFAULT: |
| 1417 | case FSCK_OPTIONS_STRICT: |
| 1418 | case FSCK_OPTIONS_MISSING_GITMODULES: |
| 1419 | case FSCK_OPTIONS_REFS: |
| 1420 | memcpy(options, &defaults[type], sizeof(*options)); |
| 1421 | break; |
| 1422 | default: |
| 1423 | BUG("unknown fsck options type %d", type); |
| 1424 | } |
| 1425 | |
| 1426 | options->repo = repo; |
| 1427 | } |
| 1428 | |
| 1429 | void fsck_options_clear(struct fsck_options *options) |
| 1430 | { |
no outgoing calls
no test coverage detected