pack-objects: move thread autodetection closer to relevant code
Let's keep thread stuff close together if possible. And in this case, this even reduces the #ifdef noise, and allows for skipping the autodetection altogether if delta search is not needed (like with a pure clone). Signed-off-by: Nicolas Pitre <nico@fluxnic.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Nicolas Pitre committed
Nov 4, 2009 at 16:32 UTC
ef0555712c9821cc163508777f20b934bf146971
1 file changed
+2
-5
builtin-pack-objects.c
+2
-5
@@ -1629,6 +1629,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,
1629
struct thread_params *p;
1630
int i, ret, active_threads = 0;
1631
1632
+ if (!delta_search_threads) /* --threads=0 means autodetect */
1633
+ delta_search_threads = online_cpus();
1634
if (delta_search_threads <= 1) {
1635
find_deltas(list, &list_size, window, depth, processed);
1636
return;
@@ -2324,11 +2326,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
2326
if (keep_unreachable && unpack_unreachable)
2327
die("--keep-unreachable and --unpack-unreachable are incompatible.");
2328
2327
-#ifdef THREADED_DELTA_SEARCH
2328
- if (!delta_search_threads) /* --threads=0 means autodetect */
2329
- delta_search_threads = online_cpus();
2330
-#endif
2331
-
2329
prepare_packed_git();
2330
2331
if (progress)