summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Martín Nieto <cmn@dwim.me>2015-03-11 17:16:39 +0100
committerCarlos Martín Nieto <cmn@dwim.me>2015-03-11 17:24:14 +0100
commit0ef54a63580171b341d85dee65c063bee31ba35f (patch)
treeeea6dec02c0c02546a24b2b98bd6def61b29d563
parent61ccba0d5630eee7f88d34c872b71777df124c70 (diff)
downloadlibgit2-cmn/local-pack-threading.tar.gz
local: create pack with multiple threadscmn/local-pack-threading
The default behaviour for the packbuilder is to perform the work in a single thread, which is fine for the public API, but we currently have no way for a user to determine the number of threads to use when creating the packfile, which makes our clone behaviour over the filesystem quite a bit slower than what git offers. This is a very particular scenario, in which we avoid spawning git by being ourselves the server-side, so it's probably ok to auto-set the threading, as the upload-pack process would do if we were talking to git.
-rw-r--r--CHANGELOG.md3
-rw-r--r--src/transports/local.c3
2 files changed, 6 insertions, 0 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0970bfdc8..77477a305 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 bedd2390b..588b7ce17 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;
}