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 <dtur...@twopensource.com>
---
 Documentation/config.txt | 6 ++++++
 cache.h                  | 1 +
 config.c                 | 5 +++++
 environment.c            | 5 +++++
 read-cache.c             | 5 ++++-
 5 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/Documentation/config.txt b/Documentation/config.txt
index 8ec8824..f61e6fe 100644
--- a/Documentation/config.txt
+++ b/Documentation/config.txt
@@ -670,6 +670,12 @@ Likewise, when the `LV` environment variable is unset, Git 
sets it
 to `-c`.  You can override this setting by exporting `LV` with
 another value or setting `core.pager` to `lv +c`.
 
+core.waitforindexhelper::
+       If true, git status and other commands which use the index
+       will wait for a response from the index-helper before continuing;
+       this gives time for the index-helper to communicate with watchman
+       and give information about modified files.
+
 core.whitespace::
        A comma separated list of common whitespace problems to
        notice.  'git diff' will use `color.diff.whitespace` to
diff --git a/cache.h b/cache.h
index 5713835..db66451 100644
--- a/cache.h
+++ b/cache.h
@@ -691,6 +691,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 470cd7b..23dbb73 100644
--- a/read-cache.c
+++ b/read-cache.c
@@ -1800,7 +1800,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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to