Message ID | 3d36511d5d95d2a2713b3cc8e2138b689d381c79.1576583819.git.liu.denton@gmail.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | t: replace incorrect test_must_fail usage (part 1) | expand |
On Tue, Dec 17, 2019 at 7:02 AM Denton Liu <liu.denton@gmail.com> wrote: > The test_must_fail() family of functions (including test_might_fail()) > should only be used on git commands. Replace test_might_fail() with > test_non_git_might_fail(). > > Signed-off-by: Denton Liu <liu.denton@gmail.com> > --- > diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh > @@ -350,7 +350,7 @@ test_expect_success 'Multi-worktree setup' ' > cp repo.git/HEAD repo.git/index repo.git/repos/foo && > - test_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && > + test_non_git_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && Can you update the commit message to show that this change is indeed the correct choice so that readers of this patch don't have to go through the same investigative reasoning process you went through to convince yourself that it is correct. In other words, why was test_might_fail() used in the first place? Is it because there might not be a sharedindex.* file? Or is it because repo.git/repos/foo might not be writable? Or what? The answer to these questions should explain to the reader, for instance, why you chose to use `test_non_git_might_fail cp ...` as opposed to a simple `cp -f ...`.
diff --git a/t/t1501-work-tree.sh b/t/t1501-work-tree.sh index 3498d3d55e..067301a5ab 100755 --- a/t/t1501-work-tree.sh +++ b/t/t1501-work-tree.sh @@ -350,7 +350,7 @@ test_expect_success 'Multi-worktree setup' ' mkdir work && mkdir -p repo.git/repos/foo && cp repo.git/HEAD repo.git/index repo.git/repos/foo && - test_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && + test_non_git_might_fail cp repo.git/sharedindex.* repo.git/repos/foo && sane_unset GIT_DIR GIT_CONFIG GIT_WORK_TREE '
The test_must_fail() family of functions (including test_might_fail()) should only be used on git commands. Replace test_might_fail() with test_non_git_might_fail(). Signed-off-by: Denton Liu <liu.denton@gmail.com> --- t/t1501-work-tree.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)