(command.CommandList children: [ (command.Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (lhs_expr.LhsName name:test_description) op: Equal rhs: {(SQ <'diff --no-index'>)} ) ] ) (C {(.)} {(./test-lib.sh)}) (C {(test_expect_success)} {(SQ <setup>)} { (SQ <'\n'> <'\tmkdir a &&\n'> <'\tmkdir b &&\n'> <'\techo 1 >a/1 &&\n'> <'\techo 2 >a/2 &&\n'> <'\tgit init repo &&\n'> <'\techo 1 >repo/a &&\n'> <'\tmkdir -p non/git &&\n'> <'\techo 1 >non/git/a &&\n'> <'\techo 1 >non/git/b\n'> ) } ) (C {(test_expect_success)} {(SQ <'git diff --no-index directories'>)} { (SQ <'\n'> <'\ttest_expect_code 1 git diff --no-index a b >cnt &&\n'> <'\ttest_line_count = 14 cnt\n'> ) } ) (C {(test_expect_success)} {(SQ <'git diff --no-index relative path outside repo'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd repo &&\n'> <'\t\ttest_expect_code 0 git diff --no-index a ../non/git/a &&\n'> <'\t\ttest_expect_code 0 git diff --no-index ../non/git/a ../non/git/b\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'git diff --no-index with broken index'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd repo &&\n'> <'\t\techo broken >.git/index &&\n'> <'\t\tgit diff --no-index a ../non/git/a\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'git diff outside repo with broken index'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd repo &&\n'> <'\t\tgit diff ../non/git/a ../non/git/b\n'> <'\t)\n'>) } ) (C {(test_expect_success)} {(SQ <'git diff --no-index executed outside repo gives correct error message'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tGIT_CEILING_DIRECTORIES=$TRASH_DIRECTORY/non &&\n'> <'\t\texport GIT_CEILING_DIRECTORIES &&\n'> <'\t\tcd non/git &&\n'> <'\t\ttest_must_fail git diff --no-index a 2>actual.err &&\n'> <'\t\techo "usage: git diff --no-index <path> <path>" >expect.err &&\n'> <'\t\ttest_cmp expect.err actual.err\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff D F and diff F D'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd repo &&\n'> <'\t\techo in-repo >a &&\n'> <'\t\techo non-repo >../non/git/a &&\n'> <'\t\tmkdir sub &&\n'> <'\t\techo sub-repo >sub/a &&\n'> <'\n'> <'\t\ttest_must_fail git diff --no-index sub/a ../non/git/a >expect &&\n'> <'\t\ttest_must_fail git diff --no-index sub/a ../non/git/ >actual &&\n'> <'\t\ttest_cmp expect actual &&\n'> <'\n'> <'\t\ttest_must_fail git diff --no-index a ../non/git/a >expect &&\n'> <'\t\ttest_must_fail git diff --no-index a ../non/git/ >actual &&\n'> <'\t\ttest_cmp expect actual &&\n'> <'\n'> <'\t\ttest_must_fail git diff --no-index ../non/git/a a >expect &&\n'> <'\t\ttest_must_fail git diff --no-index ../non/git a >actual &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'turning a file into a directory'>)} { (SQ <'\n'> <'\t(\n'> <'\t\tcd non/git &&\n'> <'\t\tmkdir d e e/sub &&\n'> <'\t\techo 1 >d/sub &&\n'> <'\t\techo 2 >e/sub/file &&\n'> <'\t\tprintf "D\\td/sub\\nA\\te/sub/file\\n" >expect &&\n'> <'\t\ttest_must_fail git diff --no-index --name-status d e >actual &&\n'> <'\t\ttest_cmp expect actual\n'> <'\t)\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff from repo subdir shows real paths (explicit)'>)} { (SQ <'\n'> <'\techo "diff --git a/../../non/git/a b/../../non/git/b" >expect &&\n'> <'\ttest_expect_code 1 \\\n'> <'\t\tgit -C repo/sub \\\n'> <'\t\tdiff --no-index ../../non/git/a ../../non/git/b >actual &&\n'> <'\thead -n 1 <actual >actual.head &&\n'> <'\ttest_cmp expect actual.head\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff from repo subdir shows real paths (implicit)'>)} { (SQ <'\n'> <'\techo "diff --git a/../../non/git/a b/../../non/git/b" >expect &&\n'> <'\ttest_expect_code 1 \\\n'> <'\t\tgit -C repo/sub \\\n'> <'\t\tdiff ../../non/git/a ../../non/git/b >actual &&\n'> <'\thead -n 1 <actual >actual.head &&\n'> <'\ttest_cmp expect actual.head\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff --no-index from repo subdir respects config (explicit)'>)} { (SQ <'\n'> <'\techo "diff --git ../../non/git/a ../../non/git/b" >expect &&\n'> <'\ttest_config -C repo diff.noprefix true &&\n'> <'\ttest_expect_code 1 \\\n'> <'\t\tgit -C repo/sub \\\n'> <'\t\tdiff --no-index ../../non/git/a ../../non/git/b >actual &&\n'> <'\thead -n 1 <actual >actual.head &&\n'> <'\ttest_cmp expect actual.head\n'> ) } ) (C {(test_expect_success)} {(SQ <'diff --no-index from repo subdir respects config (implicit)'>)} { (SQ <'\n'> <'\techo "diff --git ../../non/git/a ../../non/git/b" >expect &&\n'> <'\ttest_config -C repo diff.noprefix true &&\n'> <'\ttest_expect_code 1 \\\n'> <'\t\tgit -C repo/sub \\\n'> <'\t\tdiff ../../non/git/a ../../non/git/b >actual &&\n'> <'\thead -n 1 <actual >actual.head &&\n'> <'\ttest_cmp expect actual.head\n'> ) } ) (C {(test_done)}) ] )