| 1768 | } |
| 1769 | |
| 1770 | static int fetch_finish(int retvalue, struct strbuf *err UNUSED, |
| 1771 | void *cb, void *task_cb) |
| 1772 | { |
| 1773 | struct submodule_parallel_fetch *spf = cb; |
| 1774 | struct fetch_task *task = task_cb; |
| 1775 | |
| 1776 | struct string_list_item *it; |
| 1777 | struct changed_submodule_data *cs_data; |
| 1778 | |
| 1779 | if (!task || !task->sub) |
| 1780 | BUG("callback cookie bogus"); |
| 1781 | |
| 1782 | if (retvalue) { |
| 1783 | /* |
| 1784 | * NEEDSWORK: This indicates that the overall fetch |
| 1785 | * failed, even though there may be a subsequent fetch |
| 1786 | * by commit hash that might work. It may be a good |
| 1787 | * idea to not indicate failure in this case, and only |
| 1788 | * indicate failure if the subsequent fetch fails. |
| 1789 | */ |
| 1790 | spf->result = 1; |
| 1791 | |
| 1792 | strbuf_addf(&spf->submodules_with_errors, "\t%s\n", |
| 1793 | task->sub->name); |
| 1794 | } |
| 1795 | |
| 1796 | /* Is this the second time we process this submodule? */ |
| 1797 | if (task->commits) |
| 1798 | goto out; |
| 1799 | |
| 1800 | it = string_list_lookup(&spf->changed_submodule_names, task->sub->name); |
| 1801 | if (!it) |
| 1802 | /* Could be an unchanged submodule, not contained in the list */ |
| 1803 | goto out; |
| 1804 | |
| 1805 | cs_data = it->util; |
| 1806 | oid_array_filter(&cs_data->new_commits, |
| 1807 | commit_missing_in_sub, |
| 1808 | task->repo); |
| 1809 | |
| 1810 | /* Are there commits we want, but do not exist? */ |
| 1811 | if (cs_data->new_commits.nr) { |
| 1812 | task->commits = &cs_data->new_commits; |
| 1813 | ALLOC_GROW(spf->oid_fetch_tasks, |
| 1814 | spf->oid_fetch_tasks_nr + 1, |
| 1815 | spf->oid_fetch_tasks_alloc); |
| 1816 | spf->oid_fetch_tasks[spf->oid_fetch_tasks_nr] = task; |
| 1817 | spf->oid_fetch_tasks_nr++; |
| 1818 | return 0; |
| 1819 | } |
| 1820 | |
| 1821 | out: |
| 1822 | fetch_task_free(task); |
| 1823 | return 0; |
| 1824 | } |
| 1825 | |
| 1826 | int fetch_submodules(struct repository *r, |
| 1827 | const struct strvec *options, |
nothing calls this directly
no test coverage detected