Re: [PATCH v3 15/34] fsmonitor: do not try to operate on bare repos

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Jul 01 2021, Jeff Hostetler via GitGitGadget wrote:

> From: Jeff Hostetler <jeffhost@xxxxxxxxxxxxx>
>
> 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@xxxxxxxxxxxxx>
> ---
>  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....


> +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.

> +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. 



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux