diff options
author | Philip Kelley <phkelley@hotmail.com> | 2013-02-11 08:28:53 -0500 |
---|---|---|
committer | Philip Kelley <phkelley@hotmail.com> | 2013-02-11 09:35:26 -0500 |
commit | b8b897bbc54db5efe34a4adef1f12acb546ce27d (patch) | |
tree | 1952ecc9799282481e0b32e93cb3b37fc7ad61ed /src/push.c | |
parent | 8c29dca6c372cae1c6a97d78252ee1d7ac10673b (diff) | |
download | libgit2-b8b897bbc54db5efe34a4adef1f12acb546ce27d.tar.gz |
Add git_push_options, to set packbuilder parallelism
Diffstat (limited to 'src/push.c')
-rw-r--r-- | src/push.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/push.c b/src/push.c index 64aaead6e..628df7ac4 100644 --- a/src/push.c +++ b/src/push.c @@ -40,6 +40,7 @@ int git_push_new(git_push **out, git_remote *remote) p->repo = remote->repo; p->remote = remote; p->report_status = 1; + p->pb_parallelism = 1; if (git_vector_init(&p->specs, 0, push_spec_rref_cmp) < 0) { git__free(p); @@ -56,6 +57,18 @@ int git_push_new(git_push **out, git_remote *remote) return 0; } +int git_push_set_options(git_push *push, const git_push_options *opts) +{ + if (!push || !opts) + return -1; + + GITERR_CHECK_VERSION(opts, GIT_PUSH_OPTIONS_VERSION, "git_push_options"); + + push->pb_parallelism = opts->pb_parallelism; + + return 0; +} + static void free_refspec(push_spec *spec) { if (spec == NULL) @@ -449,8 +462,12 @@ static int do_push(git_push *push) * objects. In this case the client MUST send an empty pack-file. */ - if ((error = git_packbuilder_new(&push->pb, push->repo)) < 0 || - (error = calculate_work(push)) < 0 || + if ((error = git_packbuilder_new(&push->pb, push->repo)) < 0) + goto on_error; + + git_packbuilder_set_threads(push->pb, push->pb_parallelism); + + if ((error = calculate_work(push)) < 0 || (error = queue_objects(push)) < 0 || (error = transport->push(transport, push)) < 0) goto on_error; |