(List
  (= scope=<EAssignScope.GLOBAL 1> flags=0 words=[] bindings=[('test_description', {[SQ <LIT_CHARS "test separate work tree">]})])
  (Com {[LIT_CHARS .]} {[LIT_CHARS ./test-lib.sh]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS setup>]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tEMPTY_TREE=$(git write-tree) &&\n"> <LIT_CHARS "\tEMPTY_BLOB=$(git hash-object -t blob --stdin </dev/null) &&\n"> <LIT_CHARS "\tCHANGED_BLOB=$(echo changed | git hash-object -t blob --stdin) &&\n"> <LIT_CHARS "\tEMPTY_BLOB7=$(echo $EMPTY_BLOB | sed \"s/\\(.......\\).*/\\1/\") &&\n"> <LIT_CHARS "\tCHANGED_BLOB7=$(echo $CHANGED_BLOB | sed \"s/\\(.......\\).*/\\1/\") &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\tmkdir -p work/sub/dir &&\n"> <LIT_CHARS "\tmkdir -p work2 &&\n"> <LIT_CHARS "\tmv .git repo.git\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: helper for testing rev-parse">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\ttest_rev_parse() {\n"> <LIT_CHARS "\t\techo $1 >expected.bare &&\n"> <LIT_CHARS "\t\techo $2 >expected.inside-git &&\n"> <LIT_CHARS "\t\techo $3 >expected.inside-worktree &&\n"> <LIT_CHARS "\t\tif test $# -ge 4\n"> <LIT_CHARS "\t\tthen\n"> <LIT_CHARS "\t\t\techo $4 >expected.prefix\n"> <LIT_CHARS "\t\tfi &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t\tgit rev-parse --is-bare-repository >actual.bare &&\n"> <LIT_CHARS "\t\tgit rev-parse --is-inside-git-dir >actual.inside-git &&\n"> <LIT_CHARS "\t\tgit rev-parse --is-inside-work-tree >actual.inside-worktree &&\n"> <LIT_CHARS "\t\tif test $# -ge 4\n"> <LIT_CHARS "\t\tthen\n"> <LIT_CHARS "\t\t\tgit rev-parse --show-prefix >actual.prefix\n"> <LIT_CHARS "\t\tfi &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t\ttest_cmp expected.bare actual.bare &&\n"> <LIT_CHARS "\t\ttest_cmp expected.inside-git actual.inside-git &&\n"> <LIT_CHARS "\t\ttest_cmp expected.inside-worktree actual.inside-worktree &&\n"> <LIT_CHARS "\t\tif test $# -ge 4\n"> <LIT_CHARS "\t\tthen\n"> <LIT_CHARS "\t\t\t# rev-parse --show-prefix should output\n"> <LIT_CHARS "\t\t\t# a single newline when at the top of the work tree,\n"> <LIT_CHARS "\t\t\t# but we test for that separately.\n"> <LIT_CHARS "\t\t\ttest -z \"$4\" && ! test -s actual.prefix ||\n"> <LIT_CHARS "\t\t\ttest_cmp expected.prefix actual.prefix\n"> <LIT_CHARS "\t\tfi\n"> <LIT_CHARS "\t}\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: core.worktree = relative path">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tsane_unset GIT_WORK_TREE &&\n"> <LIT_CHARS "\tGIT_DIR=repo.git &&\n"> <LIT_CHARS "\tGIT_CONFIG=\"$(pwd)\"/$GIT_DIR/config &&\n"> <LIT_CHARS "\texport GIT_DIR GIT_CONFIG &&\n"> <LIT_CHARS "\tgit config core.worktree ../work\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS outside>]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\ttest_rev_parse false false false\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "inside work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work &&\n"> <LIT_CHARS "\t\tGIT_DIR=../repo.git &&\n"> <LIT_CHARS "\t\tGIT_CONFIG=\"$(pwd)\"/$GIT_DIR/config &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false true \"\"\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "empty prefix is actually written out">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo >expected &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work &&\n"> <LIT_CHARS "\t\tGIT_DIR=../repo.git &&\n"> <LIT_CHARS "\t\tGIT_CONFIG=\"$(pwd)\"/$GIT_DIR/config &&\n"> <LIT_CHARS "\t\tgit rev-parse --show-prefix >../actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "subdir of work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work/sub/dir &&\n"> <LIT_CHARS "\t\tGIT_DIR=../../../repo.git &&\n"> <LIT_CHARS "\t\tGIT_CONFIG=\"$(pwd)\"/$GIT_DIR/config &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false true sub/dir/\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: core.worktree = absolute path">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tsane_unset GIT_WORK_TREE &&\n"> <LIT_CHARS "\tGIT_DIR=$(pwd)/repo.git &&\n"> <LIT_CHARS "\tGIT_CONFIG=$GIT_DIR/config &&\n"> <LIT_CHARS "\texport GIT_DIR GIT_CONFIG &&\n"> <LIT_CHARS "\tgit config core.worktree \"$(pwd)/work\"\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS outside>]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\ttest_rev_parse false false false &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work2 &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false false\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "inside work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false true \"\"\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "subdir of work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work/sub/dir &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false true sub/dir/\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: GIT_WORK_TREE=relative (override core.worktree)">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tGIT_DIR=$(pwd)/repo.git &&\n"> <LIT_CHARS "\tGIT_CONFIG=$GIT_DIR/config &&\n"> <LIT_CHARS "\tgit config core.worktree non-existent &&\n"> <LIT_CHARS "\tGIT_WORK_TREE=work &&\n"> <LIT_CHARS "\texport GIT_DIR GIT_CONFIG GIT_WORK_TREE\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS outside>]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\ttest_rev_parse false false false &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work2 &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false false\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "inside work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=. &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false true \"\"\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "subdir of work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd work/sub/dir &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=../.. &&\n"> <LIT_CHARS "\t\ttest_rev_parse false false true sub/dir/\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "setup: GIT_WORK_TREE=absolute, below git dir">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tmv work repo.git/work &&\n"> <LIT_CHARS "\tmv work2 repo.git/work2 &&\n"> <LIT_CHARS "\tGIT_DIR=$(pwd)/repo.git &&\n"> <LIT_CHARS "\tGIT_CONFIG=$GIT_DIR/config &&\n"> <LIT_CHARS "\tGIT_WORK_TREE=$(pwd)/repo.git/work &&\n"> <LIT_CHARS "\texport GIT_DIR GIT_CONFIG GIT_WORK_TREE\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS outside>]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo outside &&\n"> <LIT_CHARS "\ttest_rev_parse false false false\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "in repo.git">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git &&\n"> <LIT_CHARS "\t\ttest_rev_parse false true false\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/objects &&\n"> <LIT_CHARS "\t\ttest_rev_parse false true false\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/work2 &&\n"> <LIT_CHARS "\t\ttest_rev_parse false true false\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "inside work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/work &&\n"> <LIT_CHARS "\t\ttest_rev_parse false true true \"\"\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "subdir of work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/work/sub/dir &&\n"> <LIT_CHARS "\t\ttest_rev_parse false true true sub/dir/\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "find work tree from repo">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo sub/dir/untracked >expected &&\n"> <LIT_CHARS "\tcat <<-\\EOF >repo.git/work/.gitignore &&\n"> <LIT_CHARS "\texpected.*\n"> <LIT_CHARS "\tactual.*\n"> <LIT_CHARS "\t.gitignore\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\t>repo.git/work/sub/dir/untracked &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git &&\n"> <LIT_CHARS "\t\tgit ls-files --others --exclude-standard >../actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "find work tree from work tree">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo sub/dir/tracked >expected &&\n"> <LIT_CHARS "\t>repo.git/work/sub/dir/tracked &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/work/sub/dir &&\n"> <LIT_CHARS "\t\tgit --git-dir=../../.. add tracked\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git &&\n"> <LIT_CHARS "\t\tgit ls-files >../actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "_gently() groks relative GIT_DIR & GIT_WORK_TREE">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/work/sub/dir &&\n"> <LIT_CHARS "\t\tGIT_DIR=../../.. &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=../.. &&\n"> <LIT_CHARS "\t\tGIT_PAGER= &&\n"> <LIT_CHARS "\t\texport GIT_DIR GIT_WORK_TREE GIT_PAGER &&\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t\tgit diff --exit-code tracked &&\n"> <LIT_CHARS "\t\techo changed >tracked &&\n"> <LIT_CHARS "\t\ttest_must_fail git diff --exit-code tracked\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "diff-index respects work tree under .git dir">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tcat >diff-index-cached.expected <<-EOF &&\n"> <LIT_CHARS "\t:000000 100644 $_z40 $EMPTY_BLOB A\tsub/dir/tracked\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\tcat >diff-index.expected <<-EOF &&\n"> <LIT_CHARS "\t:000000 100644 $_z40 $_z40 A\tsub/dir/tracked\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tGIT_DIR=repo.git &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=repo.git/work &&\n"> <LIT_CHARS "\t\texport GIT_DIR GIT_WORK_TREE &&\n"> <LIT_CHARS "\t\tgit diff-index $EMPTY_TREE >diff-index.actual &&\n"> <LIT_CHARS "\t\tgit diff-index --cached $EMPTY_TREE >diff-index-cached.actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp diff-index.expected diff-index.actual &&\n"> <LIT_CHARS "\ttest_cmp diff-index-cached.expected diff-index-cached.actual\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "diff-files respects work tree under .git dir">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tcat >diff-files.expected <<-EOF &&\n"> <LIT_CHARS "\t:100644 100644 $EMPTY_BLOB $_z40 M\tsub/dir/tracked\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tGIT_DIR=repo.git &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=repo.git/work &&\n"> <LIT_CHARS "\t\texport GIT_DIR GIT_WORK_TREE &&\n"> <LIT_CHARS "\t\tgit diff-files >diff-files.actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp diff-files.expected diff-files.actual\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "git diff respects work tree under .git dir">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tcat >diff-TREE.expected <<-EOF &&\n"> <LIT_CHARS "\tdiff --git a/sub/dir/tracked b/sub/dir/tracked\n"> <LIT_CHARS "\tnew file mode 100644\n"> <LIT_CHARS "\tindex 0000000..$CHANGED_BLOB7\n"> <LIT_CHARS "\t--- /dev/null\n"> <LIT_CHARS "\t+++ b/sub/dir/tracked\n"> <LIT_CHARS "\t@@ -0,0 +1 @@\n"> <LIT_CHARS "\t+changed\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\tcat >diff-TREE-cached.expected <<-EOF &&\n"> <LIT_CHARS "\tdiff --git a/sub/dir/tracked b/sub/dir/tracked\n"> <LIT_CHARS "\tnew file mode 100644\n"> <LIT_CHARS "\tindex 0000000..$EMPTY_BLOB7\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\tcat >diff-FILES.expected <<-EOF &&\n"> <LIT_CHARS "\tdiff --git a/sub/dir/tracked b/sub/dir/tracked\n"> <LIT_CHARS "\tindex $EMPTY_BLOB7..$CHANGED_BLOB7 100644\n"> <LIT_CHARS "\t--- a/sub/dir/tracked\n"> <LIT_CHARS "\t+++ b/sub/dir/tracked\n"> <LIT_CHARS "\t@@ -0,0 +1 @@\n"> <LIT_CHARS "\t+changed\n"> <LIT_CHARS "\tEOF\n"> <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tGIT_DIR=repo.git &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=repo.git/work &&\n"> <LIT_CHARS "\t\texport GIT_DIR GIT_WORK_TREE &&\n"> <LIT_CHARS "\t\tgit diff $EMPTY_TREE >diff-TREE.actual &&\n"> <LIT_CHARS "\t\tgit diff --cached $EMPTY_TREE >diff-TREE-cached.actual &&\n"> <LIT_CHARS "\t\tgit diff >diff-FILES.actual\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp diff-TREE.expected diff-TREE.actual &&\n"> <LIT_CHARS "\ttest_cmp diff-TREE-cached.expected diff-TREE-cached.actual &&\n"> <LIT_CHARS "\ttest_cmp diff-FILES.expected diff-FILES.actual\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "git grep">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\techo dir/tracked >expected.grep &&\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git/work/sub &&\n"> <LIT_CHARS "\t\tGIT_DIR=../.. &&\n"> <LIT_CHARS "\t\tGIT_WORK_TREE=.. &&\n"> <LIT_CHARS "\t\texport GIT_DIR GIT_WORK_TREE &&\n"> <LIT_CHARS "\t\tgit grep -l changed >../../../actual.grep\n"> <LIT_CHARS "\t) &&\n"> <LIT_CHARS "\ttest_cmp expected.grep actual.grep\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "git commit">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git &&\n"> <LIT_CHARS "\t\tGIT_DIR=. GIT_WORK_TREE=work git commit -a -m done\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "absolute pathspec should fail gracefully">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t(\n"> <LIT_CHARS "\t\tcd repo.git &&\n"> <LIT_CHARS "\t\ttest_might_fail git config --unset core.worktree &&\n"> <LIT_CHARS "\t\ttest_must_fail git log HEAD -- /home\n"> <LIT_CHARS "\t)\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "make_relative_path handles double slashes in GIT_DIR">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\t>dummy_file &&\n"> <LIT_CHARS "\techo git --git-dir=\"$(pwd)//repo.git\" --work-tree=\"$(pwd)\" add dummy_file &&\n"> <LIT_CHARS "\tgit --git-dir=\"$(pwd)//repo.git\" --work-tree=\"$(pwd)\" add dummy_file\n">]}  )
  (Com {[LIT_CHARS test_expect_success]} {[SQ <LIT_CHARS "relative $GIT_WORK_TREE and git subprocesses">]} {[SQ <LIT_CHARS "\n"> <LIT_CHARS "\tGIT_DIR=repo.git GIT_WORK_TREE=repo.git/work \\\n"> <LIT_CHARS "\ttest-subprocess --setup-work-tree rev-parse --show-toplevel >actual &&\n"> <LIT_CHARS "\techo \"$(pwd)/repo.git/work\" >expected &&\n"> <LIT_CHARS "\ttest_cmp expected actual\n">]}  )
  (Com {[LIT_CHARS test_done]}  )
)