Skip to content

Commit b38ab19

Browse files
ibgitster
authored andcommitted
t3700: merge two tests into one
Depending on the underlying platform a chmod may be a noop. Although it wouldn't harm the result of the '--chmod=-x' test, there is a more robust way to make sure the --chmod option works both ways. Merge the two separate tests for the --chmod option into one, checking both permissions on the same file. Signed-off-by: Ingo Brückl <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent c0fa44d commit b38ab19

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

t/t3700-add.sh

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -332,24 +332,18 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
332332
test_i18ncmp expect.err actual.err
333333
'
334334

335-
test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '
335+
test_expect_success 'git add --chmod=[+-]x stages correctly' '
336336
rm -f foo1 &&
337337
echo foo >foo1 &&
338338
git add --chmod=+x foo1 &&
339339
case "$(git ls-files --stage foo1)" in
340340
100755" "*foo1) echo pass;;
341341
*) echo fail; git ls-files --stage foo1; (exit 1);;
342-
esac
343-
'
344-
345-
test_expect_success 'git add --chmod=-x stages an executable file with -x' '
346-
rm -f xfoo1 &&
347-
echo foo >xfoo1 &&
348-
chmod 755 xfoo1 &&
349-
git add --chmod=-x xfoo1 &&
350-
case "$(git ls-files --stage xfoo1)" in
351-
100644" "*xfoo1) echo pass;;
352-
*) echo fail; git ls-files --stage xfoo1; (exit 1);;
342+
esac &&
343+
git add --chmod=-x foo1 &&
344+
case "$(git ls-files --stage foo1)" in
345+
100644" "*foo1) echo pass;;
346+
*) echo fail; git ls-files --stage foo1; (exit 1);;
353347
esac
354348
'
355349

0 commit comments

Comments
 (0)