Skip to content

Commit 7f9a5fc

Browse files
artagnongitster
authored andcommitted
t1510 (worktree): fix '&&' chaining
Breaks in a test assertion's && chain can potentially hide failures from earlier commands in the chain. 'unset' returns non-zero status when the variable passed was already unset on some shells; we need to change these instances to 'sane_unset'. Helped-by: Jonathan Nieder <[email protected]> Signed-off-by: Ramkumar Ramachandra <[email protected]> Acked-by: Jonathan Nieder <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 67b6afe commit 7f9a5fc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

t/t1501-worktree.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ test_expect_success 'setup: helper for testing rev-parse' '
4848
'
4949

5050
test_expect_success 'setup: core.worktree = relative path' '
51-
unset GIT_WORK_TREE;
51+
sane_unset GIT_WORK_TREE &&
5252
GIT_DIR=repo.git &&
5353
GIT_CONFIG="$(pwd)"/$GIT_DIR/config &&
5454
export GIT_DIR GIT_CONFIG &&
@@ -89,7 +89,7 @@ test_expect_success 'subdir of work tree' '
8989
'
9090

9191
test_expect_success 'setup: core.worktree = absolute path' '
92-
unset GIT_WORK_TREE;
92+
sane_unset GIT_WORK_TREE &&
9393
GIT_DIR=$(pwd)/repo.git &&
9494
GIT_CONFIG=$GIT_DIR/config &&
9595
export GIT_DIR GIT_CONFIG &&
@@ -334,7 +334,7 @@ test_expect_success 'absolute pathspec should fail gracefully' '
334334
'
335335

336336
test_expect_success 'make_relative_path handles double slashes in GIT_DIR' '
337-
>dummy_file
337+
>dummy_file &&
338338
echo git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file &&
339339
git --git-dir="$(pwd)//repo.git" --work-tree="$(pwd)" add dummy_file
340340
'

0 commit comments

Comments
 (0)