| 1506 | } |
| 1507 | |
| 1508 | static struct fetch_task *fetch_task_create(struct submodule_parallel_fetch *spf, |
| 1509 | const char *path, |
| 1510 | const struct object_id *treeish_name) |
| 1511 | { |
| 1512 | struct fetch_task *task; |
| 1513 | |
| 1514 | CALLOC_ARRAY(task, 1); |
| 1515 | |
| 1516 | if (validate_submodule_path(path) < 0) |
| 1517 | exit(128); |
| 1518 | |
| 1519 | task->sub = submodule_from_path(spf->r, treeish_name, path); |
| 1520 | |
| 1521 | if (!task->sub) { |
| 1522 | /* |
| 1523 | * No entry in .gitmodules? Technically not a submodule, |
| 1524 | * but historically we supported repositories that happen to be |
| 1525 | * in-place where a gitlink is. Keep supporting them. |
| 1526 | */ |
| 1527 | task->sub = get_non_gitmodules_submodule(path); |
| 1528 | if (!task->sub) |
| 1529 | goto cleanup; |
| 1530 | |
| 1531 | task->free_sub = 1; |
| 1532 | } |
| 1533 | |
| 1534 | if (string_list_lookup(&spf->seen_submodule_names, task->sub->name)) |
| 1535 | goto cleanup; |
| 1536 | |
| 1537 | switch (get_fetch_recurse_config(task->sub, spf)) |
| 1538 | { |
| 1539 | default: |
| 1540 | case RECURSE_SUBMODULES_DEFAULT: |
| 1541 | case RECURSE_SUBMODULES_ON_DEMAND: |
| 1542 | if (!task->sub || |
| 1543 | !string_list_lookup( |
| 1544 | &spf->changed_submodule_names, |
| 1545 | task->sub->name)) |
| 1546 | goto cleanup; |
| 1547 | task->default_argv = "on-demand"; |
| 1548 | break; |
| 1549 | case RECURSE_SUBMODULES_ON: |
| 1550 | task->default_argv = "yes"; |
| 1551 | break; |
| 1552 | case RECURSE_SUBMODULES_OFF: |
| 1553 | goto cleanup; |
| 1554 | } |
| 1555 | |
| 1556 | task->repo = get_submodule_repo_for(spf->r, path, treeish_name); |
| 1557 | |
| 1558 | return task; |
| 1559 | |
| 1560 | cleanup: |
| 1561 | fetch_task_free(task); |
| 1562 | return NULL; |
| 1563 | } |
| 1564 | |
| 1565 | static struct fetch_task * |
no test coverage detected