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

Function get_fetch_task_from_index

submodule.c:1565–1611  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1563}
1564
1565static struct fetch_task *
1566get_fetch_task_from_index(struct submodule_parallel_fetch *spf,
1567 struct strbuf *err)
1568{
1569 for (; spf->index_count < spf->r->index->cache_nr; spf->index_count++) {
1570 const struct cache_entry *ce =
1571 spf->r->index->cache[spf->index_count];
1572 struct fetch_task *task;
1573
1574 if (!S_ISGITLINK(ce->ce_mode))
1575 continue;
1576
1577 task = fetch_task_create(spf, ce->name, null_oid(the_hash_algo));
1578 if (!task)
1579 continue;
1580
1581 if (task->repo) {
1582 if (!spf->quiet)
1583 strbuf_addf(err, _("Fetching submodule %s%s\n"),
1584 spf->prefix, ce->name);
1585
1586 spf->index_count++;
1587 return task;
1588 } else {
1589 struct strbuf empty_submodule_path = STRBUF_INIT;
1590
1591 fetch_task_free(task);
1592
1593 /*
1594 * An empty directory is normal,
1595 * the submodule is not initialized
1596 */
1597 strbuf_addf(&empty_submodule_path, "%s/%s/",
1598 spf->r->worktree,
1599 ce->name);
1600 if (S_ISGITLINK(ce->ce_mode) &&
1601 !is_empty_dir(empty_submodule_path.buf)) {
1602 spf->result = 1;
1603 strbuf_addf(err,
1604 _("Could not access submodule '%s'\n"),
1605 ce->name);
1606 }
1607 strbuf_release(&empty_submodule_path);
1608 }
1609 }
1610 return NULL;
1611}
1612
1613static struct fetch_task *
1614get_fetch_task_from_changed(struct submodule_parallel_fetch *spf,

Callers 1

get_next_submoduleFunction · 0.85

Calls 6

fetch_task_createFunction · 0.85
null_oidFunction · 0.85
strbuf_addfFunction · 0.85
fetch_task_freeFunction · 0.85
is_empty_dirFunction · 0.85
strbuf_releaseFunction · 0.85

Tested by

no test coverage detected