def _get_git_ordered_files(self, rw_dir):
        """Get files as git orders them, to compare in test_tree_modifier_ordering."""
        # Create directory contents.
        Path(rw_dir, "file").mkdir()
        for filename in (
            "bin",
            "bin.d",
            "file.to",
            "file.toml",
            "file.toml.bin",
            "file0",
        ):
            Path(rw_dir, filename).touch()
        Path(rw_dir, "file", "a").touch()

        with cwd(rw_dir):
            # Prepare the repository.
            subprocess.run(["git", "init", "-q"], check=True)
            subprocess.run(["git", "add", "."], check=True)
            subprocess.run(["git", "commit", "-m", "c1"], check=True)

            # Get git output from which an ordered file list can be parsed.
            rev_parse_command = ["git", "rev-parse", "HEAD^{tree}"]
            tree_hash = subprocess.check_output(rev_parse_command).decode().strip()
            cat_file_command = ["git", "cat-file", "-p", tree_hash]
            cat_file_output = subprocess.check_output(cat_file_command).decode()

        return [line.split()[-1] for line in cat_file_output.split("\n") if line]
Get files as git orders them, to compare in test_tree_modifier_ordering.
test/test_tree.py