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 <ib@wupperonline.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ingo Brückl committed
Jul 30, 2016 at 22:13 UTC
b38ab197c2842733c6a9cddd88900fc67d6ce945
1 file changed
+6
-12
t/t3700-add.sh
+6
-12
@@ -332,24 +332,18 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
332
test_i18ncmp expect.err actual.err
333
'
334
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' '
336
rm -f foo1 &&
337
echo foo >foo1 &&
338
git add --chmod=+x foo1 &&
339
case "$(git ls-files --stage foo1)" in
340
100755" "*foo1) echo pass;;
341
*) 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);;
347
esac
348
'
349