git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "SZEDER Gábor" <szeder.dev@gmail.com>
To: Derrick Stolee via GitGitGadget <gitgitgadget@gmail.com>
Cc: git@vger.kernel.org, ukshah2@illinois.edu,
	Kevin.Willford@microsoft.com,
	Derrick Stolee <dstolee@microsoft.com>,
	Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH v2 4/8] t3030-merge-recursive.sh: disable fsmonitor when tweaking GIT_WORK_TREE
Date: Tue, 10 Dec 2019 11:07:32 +0100	[thread overview]
Message-ID: <20191210100732.GD6527@szeder.dev> (raw)
In-Reply-To: <efc16962ee2595db50bf051fc84632b8c70036b3.1575907804.git.gitgitgadget@gmail.com>

On Mon, Dec 09, 2019 at 04:10:00PM +0000, Derrick Stolee via GitGitGadget wrote:
> From: Derrick Stolee <dstolee@microsoft.com>
> 
> The fsmonitor feature allows an external tool such as watchman to
> monitor the working directory. The direct test
> t7619-status-fsmonitor.sh provides some coverage, but it would be
> better to run the entire test suite with watchman enabled. This
> would provide more confidence that the feature is working as
> intended.
> 
> Worktrees use a ".git" _file_ instead of a folder to point to
> the base repo's .git directory and the proper worktree HEAD. The
> fsmonitor hook tries to create a JSON file inside the ".git" folder
> which violates the expectation here.

Yeah, there are a couple hardcoded paths in there, e.g.:

  open ($fh, ">", ".git/watchman-response.json");

and, worse, not only in the test helper hook in
't/t7519/fsmonitor-watchman' but in the sample hook template
'templates/hooks--fsmonitor-watchman.sample' as well.

> It would be better to properly
> find a safe folder for storing this JSON file.

  git rev-parse --git-path ''

gives us the right directory prefix to use and we could then append
the various filenames that must be accessed in there.

> This is also a problem when a test script uses GIT_WORK_TREE.
> 
> Signed-off-by: Derrick Stolee <dstolee@microsoft.com>
> ---
>  t/t1510-repo-setup.sh      | 1 +
>  t/t2400-worktree-add.sh    | 2 ++
>  t/t3030-merge-recursive.sh | 2 ++
>  3 files changed, 5 insertions(+)
> 
> diff --git a/t/t1510-repo-setup.sh b/t/t1510-repo-setup.sh
> index 9974457f56..28dce0c26f 100755
> --- a/t/t1510-repo-setup.sh
> +++ b/t/t1510-repo-setup.sh
> @@ -775,6 +775,7 @@ test_expect_success '#29: setup' '
>  	setup_repo 29 non-existent gitfile true &&
>  	mkdir -p 29/sub/sub 29/wt/sub &&
>  	(
> +		GIT_TEST_FSMONITOR="" &&
>  		cd 29 &&
>  		GIT_WORK_TREE="$here/29" &&
>  		export GIT_WORK_TREE &&
> diff --git a/t/t2400-worktree-add.sh b/t/t2400-worktree-add.sh
> index e819ba741e..d4d3cbae0f 100755
> --- a/t/t2400-worktree-add.sh
> +++ b/t/t2400-worktree-add.sh
> @@ -1,5 +1,7 @@
>  #!/bin/sh
>  
> +GIT_TEST_FSMONITOR=""
> +
>  test_description='test git worktree add'
>  
>  . ./test-lib.sh
> diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh
> index ff641b348a..62f645d639 100755
> --- a/t/t3030-merge-recursive.sh
> +++ b/t/t3030-merge-recursive.sh
> @@ -520,6 +520,7 @@ test_expect_success 'reset and bind merge' '
>  
>  test_expect_success 'merge-recursive w/ empty work tree - ours has rename' '
>  	(
> +		GIT_TEST_FSMONITOR="" &&
>  		GIT_WORK_TREE="$PWD/ours-has-rename-work" &&
>  		export GIT_WORK_TREE &&
>  		GIT_INDEX_FILE="$PWD/ours-has-rename-index" &&
> @@ -545,6 +546,7 @@ test_expect_success 'merge-recursive w/ empty work tree - ours has rename' '
>  
>  test_expect_success 'merge-recursive w/ empty work tree - theirs has rename' '
>  	(
> +		GIT_TEST_FSMONITOR="" &&
>  		GIT_WORK_TREE="$PWD/theirs-has-rename-work" &&
>  		export GIT_WORK_TREE &&
>  		GIT_INDEX_FILE="$PWD/theirs-has-rename-index" &&
> -- 
> gitgitgadget
> 

  reply	other threads:[~2019-12-10 10:07 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-21 22:20 [PATCH 00/11] Improve testability with GIT_TEST_FSMONITOR Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 01/11] fsmonitor: disable in a bare repo Derrick Stolee via GitGitGadget
2019-11-21 23:18   ` Denton Liu
2019-11-22  1:57     ` Derrick Stolee
2019-11-21 22:20 ` [PATCH 02/11] fsmonitor: do not output to stderr for tests Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 03/11] t1301-shared-repo.sh: disable FSMONITOR Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 04/11] t1510-repo-setup.sh: disable fsmonitor if no .git dir Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 05/11] fsmonitor: disable fsmonitor with worktrees Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 06/11] t3030-merge-recursive.sh: disable fsmonitor when tweaking GIT_WORK_TREE Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 07/11] t3600-rm.sh: disable fsmonitor when deleting populated submodule Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 08/11] tests: disable fsmonitor in submodule tests Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 09/11] t7063: disable fsmonitor with status cache Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 10/11] t7519: disable external GIT_TEST_FSMONITOR variable Derrick Stolee via GitGitGadget
2019-11-21 22:20 ` [PATCH 11/11] test-lib: clear watchman watches at test completion Derrick Stolee via GitGitGadget
2019-11-22  1:06   ` SZEDER Gábor
2019-12-09 14:12     ` Derrick Stolee
2019-12-09 23:40       ` SZEDER Gábor
2019-12-10  1:43         ` Derrick Stolee
2019-12-09 16:09 ` [PATCH v2 0/8] Improve testability with GIT_TEST_FSMONITOR Derrick Stolee via GitGitGadget
2019-12-09 16:09   ` [PATCH v2 1/8] fsmonitor: disable in a bare repo Derrick Stolee via GitGitGadget
2019-12-10  9:46     ` SZEDER Gábor
2019-12-09 16:09   ` [PATCH v2 2/8] fsmonitor: do not output to stderr for tests Derrick Stolee via GitGitGadget
2019-12-09 16:09   ` [PATCH v2 3/8] t1301-shared-repo.sh: disable FSMONITOR Derrick Stolee via GitGitGadget
2019-12-10  9:43     ` SZEDER Gábor
2019-12-09 16:10   ` [PATCH v2 4/8] t3030-merge-recursive.sh: disable fsmonitor when tweaking GIT_WORK_TREE Derrick Stolee via GitGitGadget
2019-12-10 10:07     ` SZEDER Gábor [this message]
2019-12-10 13:45       ` Derrick Stolee
2019-12-10 14:57         ` SZEDER Gábor
2019-12-10 15:07         ` SZEDER Gábor
2020-01-23 15:45           ` Derrick Stolee
2019-12-09 16:10   ` [PATCH v2 5/8] tests: disable fsmonitor in submodule tests Derrick Stolee via GitGitGadget
2019-12-10 10:13     ` SZEDER Gábor
2019-12-10 13:57       ` Derrick Stolee
2019-12-09 16:10   ` [PATCH v2 6/8] t7063: disable fsmonitor with status cache Derrick Stolee via GitGitGadget
2019-12-09 16:10   ` [PATCH v2 7/8] t7519: disable external GIT_TEST_FSMONITOR variable Derrick Stolee via GitGitGadget
2019-12-09 16:10   ` [PATCH v2 8/8] test-lib: clear watchman watches at test completion Derrick Stolee via GitGitGadget
2019-12-09 22:52     ` Junio C Hamano
2019-12-10  1:49       ` Derrick Stolee
2019-12-10  5:20         ` Junio C Hamano
2019-12-10 13:51           ` Derrick Stolee
2019-12-10 14:09           ` 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

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

  git send-email \
    --in-reply-to=20191210100732.GD6527@szeder.dev \
    --to=szeder.dev@gmail.com \
    --cc=Kevin.Willford@microsoft.com \
    --cc=dstolee@microsoft.com \
    --cc=git@vger.kernel.org \
    --cc=gitgitgadget@gmail.com \
    --cc=gitster@pobox.com \
    --cc=ukshah2@illinois.edu \
    /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.
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 NNTP newsgroup(s).