git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alex Vandiver <alexmv@dropbox.com>
To: git@vger.kernel.org
Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Ben Peart <peartben@gmail.com>
Subject: [PATCH 3/6] fsmonitor: Update helper tool, now that flags are filled later
Date: Mon, 18 Dec 2017 16:28:55 -0800	[thread overview]
Message-ID: <e3246bad10b891d8e3f751b6ed368a9e3f37c425.1513642743.git.alexmv@dropbox.com> (raw)
In-Reply-To: <20171219002858.22214-1-alexmv@dropbox.com>
In-Reply-To: <95804e03dec9bd9d1a28ab92ed4356c37950468f.1513642743.git.alexmv@dropbox.com>

dd9005a0a ("fsmonitor: delay updating state until after split index is
merged", 2017-10-27) began deferring the setting of the
CE_FSMONITOR_VALID flag until later, such that do_read_index() does
not perform those steps.  This means that t/helper/test-dump-fsmonitor
showed all bits as always unset.

Split out the code which inflates the ewah into CE_FSMONITOR_VALID
bits, and call that from t/helper/test-dump-fsmonitor.  We cannot
simply switch the code to call read_index_from or the more specific
tweak_fsmonitor, because the latter would modify the extension state
by calling add_fsmonitor.

Signed-off-by: Alex Vandiver <alexmv@dropbox.com>
---
 fsmonitor.c                    | 9 ++++++++-
 fsmonitor.h                    | 6 ++++++
 t/helper/test-dump-fsmonitor.c | 2 ++
 3 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/fsmonitor.c b/fsmonitor.c
index 0af7c4edb..7011dff15 100644
--- a/fsmonitor.c
+++ b/fsmonitor.c
@@ -227,7 +227,7 @@ void remove_fsmonitor(struct index_state *istate)
 	}
 }
 
-void tweak_fsmonitor(struct index_state *istate)
+void inflate_fsmonitor_ewah(struct index_state *istate)
 {
 	int i;
 	int fsmonitor_enabled = git_config_get_fsmonitor();
@@ -250,6 +250,13 @@ void tweak_fsmonitor(struct index_state *istate)
 		ewah_free(istate->fsmonitor_dirty);
 		istate->fsmonitor_dirty = NULL;
 	}
+}
+
+void tweak_fsmonitor(struct index_state *istate)
+{
+	int fsmonitor_enabled = git_config_get_fsmonitor();
+
+	inflate_fsmonitor_ewah(istate);
 
 	switch (fsmonitor_enabled) {
 	case -1: /* keep: do nothing */
diff --git a/fsmonitor.h b/fsmonitor.h
index 5f68ca4d2..619852d4b 100644
--- a/fsmonitor.h
+++ b/fsmonitor.h
@@ -28,6 +28,12 @@ extern void write_fsmonitor_extension(struct strbuf *sb, struct index_state *ist
 extern void add_fsmonitor(struct index_state *istate);
 extern void remove_fsmonitor(struct index_state *istate);
 
+/*
+ * Inflate the fsmonitor_dirty ewah into the CE_FSMONITOR_VALID bits.
+ * Called by tweak_fsmonitor.
+ */
+extern void inflate_fsmonitor_ewah(struct index_state *istate);
+
 /*
  * Add/remove the fsmonitor index extension as necessary based on the current
  * core.fsmonitor setting.
diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
index ad452707e..53b19b39b 100644
--- a/t/helper/test-dump-fsmonitor.c
+++ b/t/helper/test-dump-fsmonitor.c
@@ -1,4 +1,5 @@
 #include "cache.h"
+#include "fsmonitor.h"
 
 int cmd_main(int ac, const char **av)
 {
@@ -8,6 +9,7 @@ int cmd_main(int ac, const char **av)
 	setup_git_directory();
 	if (do_read_index(istate, get_index_file(), 0) < 0)
 		die("unable to read index file");
+	inflate_fsmonitor_ewah(istate);
 	if (!istate->fsmonitor_last_update) {
 		printf("no fsmonitor\n");
 		return 0;
-- 
2.15.1.626.gc4617b774


  parent reply	other threads:[~2017-12-19  0:29 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-19  0:28 [PATCH 0/6] Minor fsmonitor bugfixes, use with `git diff` Alex Vandiver
2017-12-19  0:28 ` [PATCH 1/6] Fix comments to agree with argument name Alex Vandiver
2017-12-19  0:28   ` [PATCH 2/6] fsmonitor: Add dir.h include, for untracked_cache_invalidate_path Alex Vandiver
2017-12-19 20:17     ` Junio C Hamano
2017-12-20 20:59       ` Alex Vandiver
2017-12-21 21:47         ` Junio C Hamano
2017-12-19  0:28   ` Alex Vandiver [this message]
2017-12-20 21:12     ` [PATCH 3/6] fsmonitor: Update helper tool, now that flags are filled later Alex Vandiver
2017-12-19  0:28   ` [PATCH 4/6] fsmonitor: Add a trailing newline to test-dump-fsmonitor Alex Vandiver
2017-12-19 20:28     ` Junio C Hamano
2017-12-21  1:55       ` Alex Vandiver
2017-12-21 21:49         ` Junio C Hamano
2017-12-19  0:28   ` [PATCH 5/6] fsmonitor: Remove debugging lines from t/t7519-status-fsmonitor.sh Alex Vandiver
2017-12-19 20:19     ` Junio C Hamano
2017-12-20 17:35       ` Johannes Schindelin
2017-12-19  0:28   ` [PATCH 6/6] fsmonitor: Use fsmonitor data in `git diff` Alex Vandiver
  -- strict thread matches above, loose matches on Subject: below --
2018-01-03  3:04 [PATCH v2 0/6] Minor fsmonitor bugfixes, use with " Alex Vandiver
2018-01-03  3:04 ` [PATCH 1/6] Fix comments to agree with argument name Alex Vandiver
2018-01-03  3:04   ` [PATCH 3/6] fsmonitor: Update helper tool, now that flags are filled later Alex Vandiver
2018-01-04 23:03     ` Johannes Schindelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e3246bad10b891d8e3f751b6ed368a9e3f37c425.1513642743.git.alexmv@dropbox.com \
    --to=alexmv@dropbox.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=peartben@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).