From 07e9081fb5628e4ddc8f87e2d4ba0c7b3247bb35 Mon Sep 17 00:00:00 2001 From: Sebastian Thiel Date: Wed, 9 Mar 2022 08:27:40 +0800 Subject: [PATCH] pass thread-limit along to checkout (#301) --- gitoxide-core/src/index/checkout.rs | 2 ++ gitoxide-core/src/index/mod.rs | 4 ++++ src/plumbing/main.rs | 1 + 3 files changed, 7 insertions(+) diff --git a/gitoxide-core/src/index/checkout.rs b/gitoxide-core/src/index/checkout.rs index 1ec08cce7b1..3bbe1f269d9 100644 --- a/gitoxide-core/src/index/checkout.rs +++ b/gitoxide-core/src/index/checkout.rs @@ -17,6 +17,7 @@ pub fn checkout_exclusive( index: Options { object_hash, .. }, empty_files, keep_going, + thread_limit, }: index::checkout_exclusive::Options, ) -> anyhow::Result<()> { let repo = repo @@ -57,6 +58,7 @@ pub fn checkout_exclusive( destination_is_initially_empty: true, overwrite_existing: false, keep_going, + thread_limit, ..Default::default() }; diff --git a/gitoxide-core/src/index/mod.rs b/gitoxide-core/src/index/mod.rs index 5ef24b94266..3a2af2460e4 100644 --- a/gitoxide-core/src/index/mod.rs +++ b/gitoxide-core/src/index/mod.rs @@ -29,6 +29,10 @@ pub mod checkout_exclusive { /// If true, all files will be written with zero bytes despite having made an ODB lookup. pub empty_files: bool, pub keep_going: bool, + /// If set, don't use more than this amount of threads. + /// Otherwise, usually use as many threads as there are logical cores. + /// A value of 0 is interpreted as no-limit + pub thread_limit: Option, } } diff --git a/src/plumbing/main.rs b/src/plumbing/main.rs index c08076f95e4..11ef6ed4bf1 100644 --- a/src/plumbing/main.rs +++ b/src/plumbing/main.rs @@ -102,6 +102,7 @@ pub fn main() -> Result<()> { index: core::index::Options { object_hash, format }, empty_files, keep_going, + thread_limit, }, ) },