diff options
author | Nicolas Pitre <nico@fluxnic.net> | 2009-11-04 16:32:46 -0500 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2009-11-05 23:11:42 -0800 |
commit | ef0555712c9821cc163508777f20b934bf146971 (patch) | |
tree | 58d4797ea13be4402ef90c8a5c8330231398dbf5 | |
parent | 1b52ac5935c3773596fa41f6cf83578ab86b6b83 (diff) | |
download | git-ef0555712c9821cc163508777f20b934bf146971.tar.gz |
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>
-rw-r--r-- | builtin-pack-objects.c | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/builtin-pack-objects.c b/builtin-pack-objects.c index 02f9246cdb..4c91e944c2 100644 --- a/builtin-pack-objects.c +++ b/builtin-pack-objects.c @@ -1629,6 +1629,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size, struct thread_params *p; int i, ret, active_threads = 0; + if (!delta_search_threads) /* --threads=0 means autodetect */ + delta_search_threads = online_cpus(); if (delta_search_threads <= 1) { find_deltas(list, &list_size, window, depth, processed); return; @@ -2324,11 +2326,6 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix) if (keep_unreachable && unpack_unreachable) die("--keep-unreachable and --unpack-unreachable are incompatible."); -#ifdef THREADED_DELTA_SEARCH - if (!delta_search_threads) /* --threads=0 means autodetect */ - delta_search_threads = online_cpus(); -#endif - prepare_packed_git(); if (progress) |