From: Junio C Hamano <gitster@pobox.com>
To: "Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, Johannes Schindelin <johannes.schindelin@gmx.de>
Subject: Re: [PATCH] fsmonitor: only enable it in non-bare repositories
Date: Fri, 30 Apr 2021 22:55:26 +0900 [thread overview]
Message-ID: <xmqq8s4zdghd.fsf@gitster.g> (raw)
In-Reply-To: pull.942.git.1619682362363.gitgitgadget@gmail.com
"Johannes Schindelin via GitGitGadget" <gitgitgadget@gmail.com>
writes:
> From: Johannes Schindelin <johannes.schindelin@gmx.de>
>
> The entire point of the FSMonitor is to monitor the worktree changes in
> a more efficient manner than `lstat()`ing all worktree files every time
> we refresh the index.
>
> But if there is no worktree, FSMonitor has nothing to monitor.
>
> So let's ignore if an FSMonitor is configured (e.g. in `~/.gitconfig`)
> and we're running in a repository without worktree.
>
> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
> ---
> fsmonitor: only enable it in non-bare repositories
>
> Since I released Git for Windows v2.31.0, with brief interruption of two
> weeks, I enabled the built-in FSMonitor via my user config, and today
> was the first time I did anything in a bare repository. I was somewhat
> surprised that FSMonitor gave me trouble there, as the FSMonitor does
> not even make sense there...
>
> This patch applies on top of jh/rfc-builtin-fsmonitor (not because it
> fixes a problem in the built-in FSMonitor, the bug existed for a long,
> long time before those patches, but because it would otherwise cause
> merge conflicts with that patch series).
>
> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-942%2Fdscho%2Fbare-repositories-need-no-fsmonitor-v1
> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-942/dscho/bare-repositories-need-no-fsmonitor-v1
> Pull-Request: https://github.com/gitgitgadget/git/pull/942
>
> config.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/config.c b/config.c
> index 53e7dedc60de..fc5e744d81ca 100644
> --- a/config.c
> +++ b/config.c
> @@ -2515,6 +2515,12 @@ int git_config_get_max_percent_split_change(void)
>
> int repo_config_get_fsmonitor(struct repository *r)
> {
> + if (!r->worktree) {
> + /* FSMonitor makes no sense in bare repositories */
> + core_fsmonitor = 0;
Use NULL instead of integer 0 to mollify SP.
> + return 1;
> + }
> +
> if (r->settings.use_builtin_fsmonitor > 0) {
> core_fsmonitor = "(built-in daemon)";
> return 1;
>
> base-commit: 14d50074ff19e68e7a8d718b22d138882087bbc9
next prev parent reply other threads:[~2021-04-30 13:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-29 7:46 [PATCH] fsmonitor: only enable it in non-bare repositories Johannes Schindelin via GitGitGadget
2021-04-30 13:55 ` Junio C Hamano [this message]
2021-05-03 9:11 ` [PATCH v2] " Johannes Schindelin via GitGitGadget
2021-05-03 13:58 ` [PATCH] " Ævar Arnfjörð Bjarmason
2021-05-03 17:27 ` Jeff Hostetler
2021-05-03 17:56 ` Ævar Arnfjörð Bjarmason
2021-05-11 19:24 ` Jeff Hostetler
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=xmqq8s4zdghd.fsf@gitster.g \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=gitgitgadget@gmail.com \
--cc=johannes.schindelin@gmx.de \
/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).