From: Johannes Schindelin <Johannes.Schindelin@gmx.de>
To: Alex Vandiver <alexmv@dropbox.com>
Cc: git@vger.kernel.org, Ben Peart <peartben@gmail.com>
Subject: Re: [PATCH 3/6] fsmonitor: Update helper tool, now that flags are filled later
Date: Fri, 5 Jan 2018 00:03:24 +0100 (STD) [thread overview]
Message-ID: <alpine.DEB.2.21.1.1801042348500.32@MININT-6BKU6QN.europe.corp.microsoft.com> (raw)
In-Reply-To: <fb10a998d5a8250f26d3504a1d1f5ca6723160d7.1514948078.git.alexmv@dropbox.com>
Hi Alex,
On Tue, 2 Jan 2018, Alex Vandiver wrote:
> diff --git a/config.c b/config.c
> index e617c2018..7c6ed888e 100644
> --- a/config.c
> +++ b/config.c
> @@ -2174,8 +2174,13 @@ int git_config_get_fsmonitor(void)
> if (core_fsmonitor && !*core_fsmonitor)
> core_fsmonitor = NULL;
>
> - if (core_fsmonitor)
> - return 1;
> +
> + if (core_fsmonitor) {
> + if (!strcasecmp(core_fsmonitor, "keep"))
> + return -1;
> + else
> + return 1;
> + }
It took me a while to reason about this:
- there is no existing code path that can return -1 from
git_config_get_fsmonitor(),
- the callers in builtin/update-index.c (testing explicitly for 0 and 1)
do not matter because they only trigger warnings.
- the remaining two callers are in fsmonitor.c:
- tweak_fsmonitor() (which handles -1 specifically), and
- inflate_fsmonitor_ewah(), which only tests whether
git_config_get_fsmonitor() returned a non-zero value, but that test is
inside a code block that is only triggered if the index has an
fsmonitor_dirty array, meaning: it already had fsmonitor enabled.
Therefore the test is legitimate.
This would take the next reader as much time, I would wager a bet. So
maybe you can include this information (or at least the information about
inflate_fsmonitor_ewah()) in the commit message?
> diff --git a/t/helper/test-dump-fsmonitor.c b/t/helper/test-dump-fsmonitor.c
> index ad452707e..48c4bab0b 100644
> --- a/t/helper/test-dump-fsmonitor.c
> +++ b/t/helper/test-dump-fsmonitor.c
> @@ -1,12 +1,14 @@
> #include "cache.h"
> +#include "config.h"
>
> int cmd_main(int ac, const char **av)
> {
> struct index_state *istate = &the_index;
> int i;
>
> + git_config_push_parameter("core.fsmonitor=keep");
The alternative would be to use an environment variable. We already use
GIT_FSMONITOR_TEST.
However, I wonder why we need this. Do we really update the index anywhere
in the tests, then *toggle* the core.fsmonitor setting, and *then* call
test-dump-fsmonitor?
And if we do, can't we simply avoid it?
Ciao,
Johannes
next prev parent reply other threads:[~2018-01-04 23:03 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-03 3:04 [PATCH v2 0/6] Minor fsmonitor bugfixes, use with `git diff` 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 2/6] fsmonitor: Stop inline'ing mark_fsmonitor_valid / _invalid Alex Vandiver
2018-01-04 22:27 ` Johannes Schindelin
2018-01-08 20:27 ` Ben Peart
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 [this message]
2018-01-03 3:04 ` [PATCH 4/6] fsmonitor: Make output of test-dump-fsmonitor more concise Alex Vandiver
2018-01-04 22:33 ` Johannes Schindelin
2018-01-08 20:33 ` Ben Peart
2018-01-03 3:04 ` [PATCH 5/6] fsmonitor: Remove debugging lines from t/t7519-status-fsmonitor.sh Alex Vandiver
2018-01-03 3:04 ` [PATCH 6/6] fsmonitor: Use fsmonitor data in `git diff` Alex Vandiver
2018-01-04 22:46 ` Johannes Schindelin
2018-01-05 22:22 ` Junio C Hamano
2018-01-08 20:58 ` Ben Peart
-- strict thread matches above, loose matches on Subject: below --
2017-12-19 0:28 [PATCH 0/6] Minor fsmonitor bugfixes, use with " 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 3/6] fsmonitor: Update helper tool, now that flags are filled later Alex Vandiver
2017-12-20 21:12 ` Alex Vandiver
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=alpine.DEB.2.21.1.1801042348500.32@MININT-6BKU6QN.europe.corp.microsoft.com \
--to=johannes.schindelin@gmx.de \
--cc=alexmv@dropbox.com \
--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).