@@ -1472,6 +1472,8 @@ struct submodule_update_clone {
1472
1472
/* failed clones to be retried again */
1473
1473
const struct cache_entry * * failed_clones ;
1474
1474
int failed_clones_nr , failed_clones_alloc ;
1475
+
1476
+ int max_jobs ;
1475
1477
};
1476
1478
#define SUBMODULE_UPDATE_CLONE_INIT {0, MODULE_LIST_INIT, 0, \
1477
1479
SUBMODULE_UPDATE_STRATEGY_INIT, 0, 0, -1, STRING_LIST_INIT_DUP, 0, \
@@ -1714,11 +1716,36 @@ static int gitmodules_update_clone_config(const char *var, const char *value,
1714
1716
return 0 ;
1715
1717
}
1716
1718
1719
+ static int update_submodules (struct submodule_update_clone * suc )
1720
+ {
1721
+ struct string_list_item * item ;
1722
+
1723
+ run_processes_parallel (suc -> max_jobs ,
1724
+ update_clone_get_next_task ,
1725
+ update_clone_start_failure ,
1726
+ update_clone_task_finished ,
1727
+ suc );
1728
+
1729
+ /*
1730
+ * We saved the output and put it out all at once now.
1731
+ * That means:
1732
+ * - the listener does not have to interleave their (checkout)
1733
+ * work with our fetching. The writes involved in a
1734
+ * checkout involve more straightforward sequential I/O.
1735
+ * - the listener can avoid doing any work if fetching failed.
1736
+ */
1737
+ if (suc -> quickstop )
1738
+ return 1 ;
1739
+
1740
+ for_each_string_list_item (item , & suc -> projectlines )
1741
+ fprintf (stdout , "%s" , item -> string );
1742
+
1743
+ return 0 ;
1744
+ }
1745
+
1717
1746
static int update_clone (int argc , const char * * argv , const char * prefix )
1718
1747
{
1719
1748
const char * update = NULL ;
1720
- int max_jobs = 1 ;
1721
- struct string_list_item * item ;
1722
1749
struct pathspec pathspec ;
1723
1750
struct submodule_update_clone suc = SUBMODULE_UPDATE_CLONE_INIT ;
1724
1751
@@ -1740,7 +1767,7 @@ static int update_clone(int argc, const char **argv, const char *prefix)
1740
1767
OPT_STRING (0 , "depth" , & suc .depth , "<depth>" ,
1741
1768
N_ ("Create a shallow clone truncated to the "
1742
1769
"specified number of revisions" )),
1743
- OPT_INTEGER ('j' , "jobs" , & max_jobs ,
1770
+ OPT_INTEGER ('j' , "jobs" , & suc . max_jobs ,
1744
1771
N_ ("parallel jobs" )),
1745
1772
OPT_BOOL (0 , "recommend-shallow" , & suc .recommend_shallow ,
1746
1773
N_ ("whether the initial clone should follow the shallow recommendation" )),
@@ -1756,8 +1783,8 @@ static int update_clone(int argc, const char **argv, const char *prefix)
1756
1783
};
1757
1784
suc .prefix = prefix ;
1758
1785
1759
- config_from_gitmodules (gitmodules_update_clone_config , & max_jobs );
1760
- git_config (gitmodules_update_clone_config , & max_jobs );
1786
+ config_from_gitmodules (gitmodules_update_clone_config , & suc . max_jobs );
1787
+ git_config (gitmodules_update_clone_config , & suc . max_jobs );
1761
1788
1762
1789
argc = parse_options (argc , argv , prefix , module_update_clone_options ,
1763
1790
git_submodule_helper_usage , 0 );
@@ -1772,27 +1799,7 @@ static int update_clone(int argc, const char **argv, const char *prefix)
1772
1799
if (pathspec .nr )
1773
1800
suc .warn_if_uninitialized = 1 ;
1774
1801
1775
- run_processes_parallel (max_jobs ,
1776
- update_clone_get_next_task ,
1777
- update_clone_start_failure ,
1778
- update_clone_task_finished ,
1779
- & suc );
1780
-
1781
- /*
1782
- * We saved the output and put it out all at once now.
1783
- * That means:
1784
- * - the listener does not have to interleave their (checkout)
1785
- * work with our fetching. The writes involved in a
1786
- * checkout involve more straightforward sequential I/O.
1787
- * - the listener can avoid doing any work if fetching failed.
1788
- */
1789
- if (suc .quickstop )
1790
- return 1 ;
1791
-
1792
- for_each_string_list_item (item , & suc .projectlines )
1793
- fprintf (stdout , "%s" , item -> string );
1794
-
1795
- return 0 ;
1802
+ return update_submodules (& suc );
1796
1803
}
1797
1804
1798
1805
static int resolve_relative_path (int argc , const char * * argv , const char * prefix )
0 commit comments