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

Function get_fetch_task_from_changed

submodule.c:1613–1679  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1611}
1612
1613static struct fetch_task *
1614get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,
1615 struct strbuf *err)
1616{
1617 for (; spf->changed_count < spf->changed_submodule_names.nr;
1618 spf->changed_count++) {
1619 struct string_list_item item =
1620 spf->changed_submodule_names.items[spf->changed_count];
1621 struct changed_submodule_data *cs_data = item.util;
1622 struct fetch_task *task;
1623
1624 if (!is_tree_submodule_active(spf->r, cs_data->super_oid,cs_data->path))
1625 continue;
1626
1627 task = fetch_task_create(spf, cs_data->path,
1628 cs_data->super_oid);
1629 if (!task)
1630 continue;
1631
1632 if (!task->repo) {
1633 strbuf_addf(err, _("Could not access submodule '%s' at commit %s\n"),
1634 cs_data->path,
1635 repo_find_unique_abbrev(the_repository, cs_data->super_oid, DEFAULT_ABBREV));
1636
1637 fetch_task_free(task);
1638 continue;
1639 }
1640
1641 if (!spf->quiet)
1642 strbuf_addf(err,
1643 _("Fetching submodule %s%s at commit %s\n"),
1644 spf->prefix, task->sub->path,
1645 repo_find_unique_abbrev(the_repository, cs_data->super_oid,
1646 DEFAULT_ABBREV));
1647
1648 spf->changed_count++;
1649 /*
1650 * NEEDSWORK: Submodules set/unset a value for
1651 * core.worktree when they are populated/unpopulated by
1652 * "git checkout" (and similar commands, see
1653 * submodule_move_head() and
1654 * connect_work_tree_and_git_dir()), but if the
1655 * submodule is unpopulated in another way (e.g. "git
1656 * rm", "rm -r"), core.worktree will still be set even
1657 * though the directory doesn't exist, and the child
1658 * process will crash while trying to chdir into the
1659 * nonexistent directory.
1660 *
1661 * In this case, we know that the submodule has no
1662 * working tree, so we can work around this by
1663 * setting "--work-tree=." (--bare does not work because
1664 * worktree settings take precedence over bare-ness).
1665 * However, this is not necessarily true in other cases,
1666 * so a generalized solution is still necessary.
1667 *
1668 * Possible solutions:
1669 * - teach "git [add|rm]" to unset core.worktree and
1670 * discourage users from removing submodules without

Callers 1

get_next_submoduleFunction · 0.85

Calls 6

is_tree_submodule_activeFunction · 0.85
fetch_task_createFunction · 0.85
strbuf_addfFunction · 0.85
repo_find_unique_abbrevFunction · 0.85
fetch_task_freeFunction · 0.85
strvec_pushFunction · 0.85

Tested by

no test coverage detected