Use git checkout on directory as some files may not be in git resulting in, e.g.:

error: pathspec 'tests/data/lorem-copy.txt' did not match any file(s) known to git.
error: pathspec 'tests/data/testimage-copy.png' did not match any file(s) known to git.
Merge pull request #8089 from bantu/autotest-checkout-pathspec

Use git checkout on directory as some files may not be in git resulting ...