Skip to content

Commit 460d562

Browse files
drafnelgitster
authored andcommitted
t/t3700: convert two uses of negation operator '!' to use test_must_fail
These two lines use the negation '!' operator to negate the result of a simple command. Since these commands do not contain any pipes or other complexities, the test_must_fail function can be used and is preferred since it will additionally detect termination due to a signal. This was noticed because the second use of '!' does not include a space between the '!' and the opening parens. Ksh interprets this as follows: !(pattern-list) Matches anything except one of the given patterns. Ksh performs a file glob using the pattern-list and then tries to execute the first file in the list. If a space is added between the '!' and the open parens, then Ksh will not interpret it as a pattern list, but in this case, it is preferred to use test_must_fail, so lets do so. Signed-off-by: Brandon Casey <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 5f7baac commit 460d562

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

t/t3700-add.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ test_expect_success 'git add --dry-run of existing changed file' "
268268

269269
test_expect_success 'git add --dry-run of non-existing file' "
270270
echo ignored-file >>.gitignore &&
271-
! (git add --dry-run track-this ignored-file >actual 2>&1) &&
271+
test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 &&
272272
echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
273273
"
274274

@@ -281,7 +281,7 @@ add 'track-this'
281281
EOF
282282

283283
test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
284-
!(git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1) &&
284+
test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual 2>&1 &&
285285
test_cmp expect actual
286286
'
287287

0 commit comments

Comments
 (0)