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

[PATCH v2 17/17] read-cache: config for waiting for index-helper

From
David Turner <dturner@twopensource.com>
Date
Mar 19, 2016, 01:04 UTC
Message-ID
<1458349490-1704-18-git-send-email-dturner@twopensource.com>
In-Reply-To
<1458349490-1704-1-git-send-email-dturner@twopensource.com>

When we poke index-helper, and index-helper is using watchman, we want to wait for a response (showing that the watchman extension shm has been prepared). If it's not using watchman, we don't.

So add a new config, core.waitforindexhelper, with sensible defaults, to configure this behavior.

Signed-off-by: David Turner <dturner@twopensource.com>
---
 cache.h       | 1 +
 config.c      | 5 +++++
 environment.c | 5 +++++
 read-cache.c  | 5 ++++-
 4 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/cache.h b/cache.h
index 4ae7dd0..f8b8dbf 100644
--- a/cache.h
+++ b/cache.h
@@ -692,6 +692,7 @@ extern char *git_replace_ref_base;
 extern int fsync_object_files;
 extern int core_preload_index;
 extern int core_watchman_sync_timeout;
+extern int wait_for_index_helper;
 extern int core_apply_sparse_checkout;
 extern int precomposed_unicode;
 extern int protect_hfs;
diff --git a/config.c b/config.c
index e6dc141..5f1b8bd 100644
--- a/config.c
+++ b/config.c
@@ -887,6 +887,11 @@ static int git_default_core_config(const char *var, const char *value)
 		return 0;
 	}
 
+	if (!strcmp(var, "core.waitforindexhelper")) {
+		wait_for_index_helper = git_config_bool(var, value);
+		return 0;
+	}
+
 	if (!strcmp(var, "core.createobject")) {
 		if (!strcmp(value, "rename"))
 			object_creation_mode = OBJECT_CREATION_USES_RENAMES;
diff --git a/environment.c b/environment.c
index 35e03c7..c7fb0a9 100644
--- a/environment.c
+++ b/environment.c
@@ -95,6 +95,11 @@ int core_preload_index = 1;
 int ignore_untracked_cache_config;
 
 int core_watchman_sync_timeout = 300;
+#ifdef USE_WATCHMAN
+int wait_for_index_helper = 1;
+#else
+int wait_for_index_helper = 0;
+#endif
 
 
 /* This is set by setup_git_dir_gently() and/or git_default_config() */
diff --git a/read-cache.c b/read-cache.c
index c141fec..7fd9b2c 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1821,7 +1821,10 @@ static int poke_daemon(struct index_state *istate,
 	if (refresh_cache) {
 		ret = write_in_full(fd, "refresh", 8) == 8;
 	} else {
-		ret = poke_and_wait_for_reply(fd);
+		if (wait_for_index_helper)
+			ret = poke_and_wait_for_reply(fd);
+		else
+			ret = write_in_full(fd, "poke", 5) == 5;
 	}
 
 	close(fd);
-- 
2.4.2.767.g62658d5-twtrsrc
Previous: David Turner
Message 25 of 25 in “index-helper, watchman”
  1. 00/15 index-helper, watchmanDavid Turner, Mar 19, 2016
  2. 01/17 read-cache.c: fix constness of verify_hdr()David Turner, Mar 19, 2016
  3. 02/17 read-cache: allow to keep mmap'd memory after readingDavid Turner, Mar 19, 2016
  4. 03/17 index-helper: new daemon for caching index and related stuffDavid Turner, Mar 19, 2016
  5. Duy NguyenMar 29, 2016
  6. David TurnerMar 29, 2016
  7. 04/17 index-helper: add --strictDavid Turner, Mar 19, 2016
  8. 05/17 daemonize(): set a flag before exiting the main processDavid Turner, Mar 19, 2016
  9. 06/17 index-helper: add --detachDavid Turner, Mar 19, 2016
  10. Duy NguyenMar 29, 2016
  11. 07/17 read-cache: add watchman 'WAMA' extensionDavid Turner, Mar 19, 2016
  12. 08/17 read-cache: invalidate untracked cache data when reading WAMADavid Turner, Mar 19, 2016
  13. Duy NguyenMar 29, 2016
  14. David TurnerMar 29, 2016
  15. 09/17 Add watchman support to reduce index refresh costDavid Turner, Mar 19, 2016
  16. Jeff HostetlerMar 24, 2016
  17. David TurnerMar 24, 2016
  18. 10/17 index-helper: use watchman to avoid refreshing index with lstat()David Turner, Mar 19, 2016
  19. 11/17 update-index: enable/disable watchman supportDavid Turner, Mar 19, 2016
  20. 12/17 unpack-trees: preserve index extensionsDavid Turner, Mar 19, 2016
  21. 13/17 index-helper: kill modeDavid Turner, Mar 19, 2016
  22. 14/17 index-helper: don't run if already runningDavid Turner, Mar 19, 2016
  23. 15/17 index-helper: autorun modeDavid Turner, Mar 19, 2016
  24. 16/17 index-helper: optionally automatically runDavid Turner, Mar 19, 2016
  25. 17/17 read-cache: config for waiting for index-helperDavid Turner, Mar 19, 2016

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.