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

[PATCH 4/6] fsmonitor: Make output of test-dump-fsmonitor more concise

From
AVAlex Vandiver <alexmv@dropbox.com>
Date
Jan 3, 2018, 03:04 UTC
Message-ID
<36db77ccb5c025a73bf3f5841cd11607427ffdc0.1514948078.git.alexmv@dropbox.com>
In-Reply-To
<20180103030456.8181-1-alexmv@dropbox.com>

Rather than display one very long line, summarize the contents of that line. The tests do not currently rely on any content except the first line ("no fsmonitor" / "fsmonitor last update").

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
---
 t/helper/test-dump-fsmonitor.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index 48c4bab0b..5d61b0d62 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -4,7 +4,8 @@
 int cmd_main(int ac, const char **av)
 {
 	struct index_state *istate = &the_index;
-	int i;
+	uint64_t now = getnanotime();
+	int i, valid = 0;
 
 	git_config_push_parameter("core.fsmonitor=keep");
 	setup_git_directory();
@@ -14,10 +15,17 @@ int cmd_main(int ac, const char **av)
 		printf("no fsmonitor\n");
 		return 0;
 	}
-	printf("fsmonitor last update %"PRIuMAX"\n", (uintmax_t)istate->fsmonitor_last_update);
+
+	printf("fsmonitor last update %"PRIuMAX", (%.2f seconds ago)\n",
+	       (uintmax_t)istate->fsmonitor_last_update,
+	       (now - istate->fsmonitor_last_update)/1.0e9);
 
 	for (i = 0; i < istate->cache_nr; i++)
-		printf((istate->cache[i]->ce_flags & CE_FSMONITOR_VALID) ? "+" : "-");
+		if (istate->cache[i]->ce_flags & CE_FSMONITOR_VALID)
+			valid++;
+
+	printf("  valid: %d\n", valid);
+	printf("  invalid: %d\n", istate->cache_nr - valid);
 
 	return 0;
 }
-- 
2.15.1.31.gddce0adfe
Previous: Ben PeartNext: Johannes Schindelin
Message 11 of 15 in “Minor fsmonitor bugfixes, use with `git diff`”
  1. 0/6 Minor fsmonitor bugfixes, use with `git diff`Alex Vandiver, Jan 3, 2018
  2. 1/6 Fix comments to agree with argument nameAlex Vandiver, Jan 3, 2018
  3. 6/6 fsmonitor: Use fsmonitor data in `git diff`Alex Vandiver, Jan 3, 2018
  4. Johannes SchindelinJan 4, 2018
  5. Junio C HamanoJan 5, 2018
  6. Ben PeartJan 8, 2018
  7. 5/6 fsmonitor: Remove debugging lines from t/t7519-status-fsmonitor.shAlex Vandiver, Jan 3, 2018
  8. 2/6 fsmonitor: Stop inline'ing mark_fsmonitor_valid / _invalidAlex Vandiver, Jan 3, 2018
  9. Johannes SchindelinJan 4, 2018
  10. Ben PeartJan 8, 2018
  11. 4/6 fsmonitor: Make output of test-dump-fsmonitor more conciseAlex Vandiver, Jan 3, 2018
  12. Johannes SchindelinJan 4, 2018
  13. Ben PeartJan 8, 2018
  14. 3/6 fsmonitor: Update helper tool, now that flags are filled laterAlex Vandiver, Jan 3, 2018
  15. Johannes SchindelinJan 4, 2018

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.