Commit 12e1fff79d29e8eee1871316eaa58f2bfa3e67ff

Edward Thomson 2015-03-12T18:04:25

Merge pull request #2973 from libgit2/cmn/local-pack-threading local: create pack with multiple threads

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 71112bf..5236a6d 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -15,6 +15,9 @@ v0.22 + 1
   removed. Use `git_repository_set_ident()` and
   `git_repository_ident()` to override the signature to be used.
 
+* The local transport now auto-scales the number of threads to use
+  when creating the packfile instead of sticking to one.
+
 ### API additions
 
 * Parsing and retrieving a configuration value as a path is exposed
diff --git a/src/transports/local.c b/src/transports/local.c
index bedd239..588b7ce 100644
--- a/src/transports/local.c
+++ b/src/transports/local.c
@@ -609,6 +609,9 @@ static int local_download_pack(
 		data.progress_payload = progress_payload;
 		data.writepack = writepack;
 
+		/* autodetect */
+		git_packbuilder_set_threads(pack, 0);
+
 		if ((error = git_packbuilder_foreach(pack, foreach_cb, &data)) != 0)
 			goto cleanup;
 	}