t3700: merge two tests into one
authorIngo Brückl <ib@wupperonline.de>
Sat, 30 Jul 2016 20:13:48 +0000 (22:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Mon, 1 Aug 2016 21:20:53 +0000 (14:20 -0700)
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>
t/t3700-add.sh
index 494f5b84f51aa56e57f0b1ae751015a93388447b..1fa5dfd5cccb77ba1e0ea4b76f25d007051dcd9e 100755 (executable)
@@ -332,24 +332,18 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
        test_i18ncmp expect.err actual.err
 '
 
-test_expect_success 'git add --chmod=+x stages a non-executable file with +x' '
+test_expect_success 'git add --chmod=[+-]x stages correctly' '
        rm -f foo1 &&
        echo foo >foo1 &&
        git add --chmod=+x foo1 &&
        case "$(git ls-files --stage foo1)" in
        100755" "*foo1) echo pass;;
        *) echo fail; git ls-files --stage foo1; (exit 1);;
-       esac
-'
-
-test_expect_success 'git add --chmod=-x stages an executable file with -x' '
-       rm -f xfoo1 &&
-       echo foo >xfoo1 &&
-       chmod 755 xfoo1 &&
-       git add --chmod=-x xfoo1 &&
-       case "$(git ls-files --stage xfoo1)" in
-       100644" "*xfoo1) echo pass;;
-       *) echo fail; git ls-files --stage xfoo1; (exit 1);;
+       esac &&
+       git add --chmod=-x foo1 &&
+       case "$(git ls-files --stage foo1)" in
+       100644" "*foo1) echo pass;;
+       *) echo fail; git ls-files --stage foo1; (exit 1);;
        esac
 '