Re: [PATCH v3 15/34] fsmonitor: do not try to operate on bare repos
- From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
- Date
- Jul 1, 2021, 22:53 UTC
- Message-ID
- <87pmw1bq64.fsf@evledraar.gmail.com>
- In-Reply-To
- <eef39aa168fec58321ee233d907db696b56ee0b8.1625150864.git.gitgitgadget@gmail.com>
On Thu, Jul 01 2021, Jeff Hostetler via GitGitGadget wrote:
Show 27 quoted lines
> From: Jeff Hostetler <jeffhost@microsoft.com>
>
> Bare repos do not have a working directory, so there is no
> directory for the daemon to register a watch upon. And therefore
> there are no files within the directory for it to actually watch.
>
> Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
> ---
> builtin/fsmonitor--daemon.c | 8 ++++++++
> t/t7519-status-fsmonitor.sh | 16 ++++++++++++++++
> 2 files changed, 24 insertions(+)
>
> diff --git a/builtin/fsmonitor--daemon.c b/builtin/fsmonitor--daemon.c
> index 7fcf960652f..d6161ad95a5 100644
> --- a/builtin/fsmonitor--daemon.c
> +++ b/builtin/fsmonitor--daemon.c
> @@ -490,6 +490,14 @@ int cmd_fsmonitor__daemon(int argc, const char **argv, const char *prefix)
> die(_("invalid 'ipc-threads' value (%d)"),
> fsmonitor__ipc_threads);
>
> + prepare_repo_settings(the_repository);
> + if (!the_repository->worktree)
> + return error(_("fsmonitor-daemon does not support bare repos '%s'"),
> + xgetcwd());
> + if (the_repository->settings.fsmonitor_mode == FSMONITOR_MODE_INCOMPATIBLE)
> + return error(_("fsmonitor-daemon is incompatible with this repo '%s'"),
> + the_repository->worktree);I commented on another patch that that second condition seems like it's only hit under core.virtualfilesystem=true....
Show 6 quoted lines
> +test_expect_success FSMONITOR_DAEMON 'try running fsmonitor-daemon in bare repo' ' > + test_when_finished "rm -rf ./bare-clone" && > + git clone --bare . ./bare-clone && > + test_must_fail git -C ./bare-clone fsmonitor--daemon run 2>actual && > + grep "fsmonitor-daemon does not support bare repos" actual > +'
Isn't just:
git init --bare bare.git
test_must_fail git -C bare.git [...]Enough, or does the repository need content to get to that error.
Show 9 quoted lines
> +test_expect_success FSMONITOR_DAEMON 'try running fsmonitor-daemon in virtual repo' ' > + test_when_finished "rm -rf ./fake-virtual-clone" && > + git clone . ./fake-virtual-clone && > + test_must_fail git -C ./fake-virtual-clone \ > + -c core.virtualfilesystem=true \ > + fsmonitor--daemon run 2>actual && > + grep "fsmonitor-daemon is incompatible with this repo" actual > +' > +
Ditto.