def test_git_diff_to_a
    work_tree = Dir.mktmpdir
    begin
      Dir.chdir(work_tree) do
        `git init`
        `git commit --allow-empty -m 'init'`
        `git worktree add --quiet child`
        Dir.chdir('child') do
          result = Git.open('.').diff.to_a
          assert_equal([], result)
        end
      end
    ensure
      FileUtils.rm_rf(work_tree)
    end
  end
Test that Git::Lib::Diff.to_a works from a linked working tree (not the
main working tree).  See https://git-scm.com/docs/git-worktree for a
description of 'main' and 'linked' working tree.

This is a real world case where '.git' in the working tree is a file
instead of a directory and where the value of GIT_INDEX_FILE is relevant.