| 1824 | } |
| 1825 | |
| 1826 | int fetch_submodules(struct repository *r, |
| 1827 | const struct strvec *options, |
| 1828 | const char *prefix, int command_line_option, |
| 1829 | int default_option, |
| 1830 | int quiet, int max_parallel_jobs) |
| 1831 | { |
| 1832 | struct submodule_parallel_fetch spf = SPF_INIT; |
| 1833 | const struct run_process_parallel_opts opts = { |
| 1834 | .tr2_category = "submodule", |
| 1835 | .tr2_label = "parallel/fetch", |
| 1836 | |
| 1837 | .processes = max_parallel_jobs, |
| 1838 | |
| 1839 | .get_next_task = get_next_submodule, |
| 1840 | .start_failure = fetch_start_failure, |
| 1841 | .task_finished = fetch_finish, |
| 1842 | .data = &spf, |
| 1843 | }; |
| 1844 | |
| 1845 | spf.r = r; |
| 1846 | spf.command_line_option = command_line_option; |
| 1847 | spf.default_option = default_option; |
| 1848 | spf.quiet = quiet; |
| 1849 | spf.prefix = prefix; |
| 1850 | |
| 1851 | if (!r->worktree) |
| 1852 | goto out; |
| 1853 | |
| 1854 | if (repo_read_index(r) < 0) |
| 1855 | die(_("index file corrupt")); |
| 1856 | |
| 1857 | strvec_push(&spf.args, "fetch"); |
| 1858 | strvec_pushv(&spf.args, options->v); |
| 1859 | strvec_push(&spf.args, "--recurse-submodules-default"); |
| 1860 | /* default value, "--submodule-prefix" and its value are added later */ |
| 1861 | |
| 1862 | calculate_changed_submodule_paths(r, &spf.changed_submodule_names); |
| 1863 | string_list_sort(&spf.changed_submodule_names); |
| 1864 | run_processes_parallel(&opts); |
| 1865 | |
| 1866 | if (spf.submodules_with_errors.len > 0) |
| 1867 | fprintf(stderr, _("Errors during submodule fetch:\n%s"), |
| 1868 | spf.submodules_with_errors.buf); |
| 1869 | |
| 1870 | |
| 1871 | strvec_clear(&spf.args); |
| 1872 | out: |
| 1873 | free_submodules_data(&spf.changed_submodule_names); |
| 1874 | string_list_clear(&spf.seen_submodule_names, 0); |
| 1875 | strbuf_release(&spf.submodules_with_errors); |
| 1876 | free(spf.oid_fetch_tasks); |
| 1877 | return spf.result; |
| 1878 | } |
| 1879 | |
| 1880 | unsigned is_submodule_modified(const char *path, int ignore_untracked) |
| 1881 | { |
no test coverage detected