git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/2] Add core.threadedcheckout config option

From
JPJames Pickens <james.e.pickens@intel.com>
Date
Dec 18, 2008, 20:56 UTC
Message-ID
<1229633811-3877-2-git-send-email-james.e.pickens@intel.com>
In-Reply-To
<1229633811-3877-1-git-send-email-james.e.pickens@intel.com>
Setting it to 'true' enables multi threaded checkout.  Default is false.
---
 Documentation/config.txt |    8 ++++++++
 cache.h                  |    1 +
 config.c                 |    5 +++++
 environment.c            |    3 +++
 unpack-trees.c           |    3 +++
 5 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/Documentation/config.txt b/Documentation/config.txt
index 21ea165..22ac76b 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -422,6 +422,14 @@ relatively high IO latencies.  With this set to 'true', git will do the
 index comparison to the filesystem data in parallel, allowing
 overlapping IO's.
 
+core.threadedcheckout::
+	Enable parallel checkout for operations like 'git checkout'
++
+This can speed up operations like 'git clone' and 'git checkout' especially
+on filesystems like NFS that have relatively high IO latencies.  With this
+set to 'true', git will write the checked out files to disk in parallel,
+allowing overlapping IO's.
+
 alias.*::
 	Command aliases for the linkgit:git[1] command wrapper - e.g.
 	after defining "alias.last = cat-file commit HEAD", the invocation
diff --git a/cache.h b/cache.h
index 231c06d..0777597 100644
--- a/cache.h
+++ b/cache.h
@@ -512,6 +512,7 @@ extern size_t delta_base_cache_limit;
 extern int auto_crlf;
 extern int fsync_object_files;
 extern int core_preload_index;
+extern int core_threaded_checkout;
 
 enum safe_crlf {
 	SAFE_CRLF_FALSE = 0,
diff --git a/config.c b/config.c
index 790405a..819693e 100644
--- a/config.c
+++ b/config.c
@@ -495,6 +495,11 @@ static int git_default_core_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "core.threadedcheckout")) {
+		core_threaded_checkout = git_config_bool(var, value);
+		return 0;
+	}
+
 	/* Add other config variables here and to Documentation/config.txt. */
 	return 0;
 }
diff --git a/environment.c b/environment.c
index e278bce..2450b65 100644
--- a/environment.c
+++ b/environment.c
@@ -46,6 +46,9 @@ enum rebase_setup_type autorebase = AUTOREBASE_NEVER;
 /* Parallel index stat data preload? */
 int core_preload_index = 0;
 
+/* Parallel checkout? */
+int core_threaded_checkout = 0;
+
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
 char *git_work_tree_cfg;
 static char *work_tree;
diff --git a/unpack-trees.c b/unpack-trees.c
index 30b9862..635b7dc 100644
--- a/unpack-trees.c
+++ b/unpack-trees.c
@@ -165,6 +165,9 @@ static int threaded_checkout(struct index_state *index, int update, struct progr
 	struct thread_data data[MAX_PARALLEL];
 	int errs = 0;
 
+	if (!core_threaded_checkout)
+		return 0;
+
 	threads = index->cache_nr / THREAD_COST;
 	if (threads > MAX_PARALLEL)
 		threads = MAX_PARALLEL;
-- 
1.6.0.4.1116.gc5d7
Previous: James PickensNext: Linus Torvalds
Message 3 of 11 in “Add support for multi threaded checkout”
  1. 0/2 Add support for multi threaded checkoutPickens, James E, Dec 18, 2008
  2. 1/2 Add support for multi threaded checkoutJames Pickens, Dec 18, 2008
  3. 2/2 Add core.threadedcheckout config optionJames Pickens, Dec 18, 2008
  4. Linus TorvaldsDec 18, 2008
  5. James PickensDec 18, 2008
  6. Linus TorvaldsDec 19, 2008
  7. Nicolas PitreDec 18, 2008
  8. James PickensDec 18, 2008
  9. Nicolas Morey-ChaisemartinDec 18, 2008
  10. James PickensDec 18, 2008
  11. James PickensDec 19, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.