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

[PATCH 5/5] update-index: enable/disable watchman support

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Nov 1, 2015, 13:55 UTC
Message-ID
<1446386146-10438-6-git-send-email-pclouds@gmail.com>
In-Reply-To
<1446386146-10438-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 builtin/update-index.c | 11 +++++++++++
 1 file changed, 11 insertions(+)
diff --git a/builtin/update-index.c b/builtin/update-index.c
index 7431938..86aec21 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -903,6 +903,7 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 {
 	int newfd, entries, has_errors = 0, line_termination = '\n';
 	int untracked_cache = -1;
+	int use_watchman = -1;
 	int read_from_stdin = 0;
 	int prefix_length = prefix ? strlen(prefix) : 0;
 	int preferred_index_format = 0;
@@ -998,6 +999,8 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 			N_("enable/disable untracked cache")),
 		OPT_SET_INT(0, "force-untracked-cache", &untracked_cache,
 			    N_("enable untracked cache without testing the filesystem"), 2),
+		OPT_BOOL(0, "watchman", &use_watchman,
+			N_("use or not use watchman to reduce refresh cost")),
 		OPT_END()
 	};
 
@@ -1127,6 +1130,14 @@ int cmd_update_index(int argc, const char **argv, const char *prefix)
 		the_index.cache_changed |= UNTRACKED_CHANGED;
 	}
 
+	if (use_watchman > 0) {
+		the_index.last_update    = xstrdup("");
+		the_index.cache_changed |= WATCHMAN_CHANGED;
+	} else if (!use_watchman) {
+		the_index.last_update    = NULL;
+		the_index.cache_changed |= WATCHMAN_CHANGED;
+	}
+
 	if (active_cache_changed) {
 		if (newfd < 0) {
 			if (refresh_args.flags & REFRESH_QUIET)
-- 
2.2.0.513.g477eb31
Previous: Nguyễn Thái Ngọc DuyNext: Paolo Ciarrocchi
Message 10 of 17 in “Use watchman to reduce index refresh time”
  1. 0/5 Use watchman to reduce index refresh timeNguyễn Thái Ngọc Duy, Nov 1, 2015
  2. 1/5 read-cache: add watchman 'WAMA' extensionNguyễn Thái Ngọc Duy, Nov 1, 2015
  3. David TurnerNov 2, 2015
  4. Duy NguyenNov 3, 2015
  5. David TurnerNov 3, 2015
  6. 2/5 Add watchman support to reduce index refresh costNguyễn Thái Ngọc Duy, Nov 1, 2015
  7. David TurnerNov 2, 2015
  8. 3/5 read-cache: allow index-helper to prepare shm before git reads itNguyễn Thái Ngọc Duy, Nov 1, 2015
  9. 4/5 index-helper: use watchman to avoid refreshing index with lstat()Nguyễn Thái Ngọc Duy, Nov 1, 2015
  10. 5/5 update-index: enable/disable watchman supportNguyễn Thái Ngọc Duy, Nov 1, 2015
  11. Paolo CiarrocchiNov 2, 2015
  12. Duy NguyenNov 2, 2015
  13. Duy NguyenNov 3, 2015
  14. Paolo CiarrocchiNov 3, 2015
  15. Christian CouderNov 9, 2015
  16. David TurnerNov 10, 2015
  17. Christian CouderNov 20, 2015

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.