Skip to content

Commit 10812c2

Browse files
Denton-Lgitster
authored andcommitted
t1501: remove use of test_might_fail cp
The test_must_fail() family of functions (including test_might_fail()) should only be used on git commands. Replace test_might_fail() with a compound command wrapping the old cp invocation that always returns 0. The `test_might_fail cp` line was introduced in 466e8d5 (t1501: fix test with split index, 2015-03-24). It is necessary because there might exist some index files in `repo.git/sharedindex.*` and, if they exist, we want to copy them over. However, if they don't exist, we don't want to error out because we expect that possibility. As a result, we want to keep the "might fail" semantics so we always return 0, even if the underlying cp errors out. Signed-off-by: Denton Liu <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 62d58cd commit 10812c2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

t/t1501-work-tree.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ test_expect_success 'Multi-worktree setup' '
350350
mkdir work &&
351351
mkdir -p repo.git/repos/foo &&
352352
cp repo.git/HEAD repo.git/index repo.git/repos/foo &&
353-
test_might_fail cp repo.git/sharedindex.* repo.git/repos/foo &&
353+
{ cp repo.git/sharedindex.* repo.git/repos/foo || :; } &&
354354
sane_unset GIT_DIR GIT_CONFIG GIT_WORK_TREE
355355
'
356356

0 commit comments

Comments
 (0)