When referencing a file in the remote repository, git requires that you specify the full path to the file.
For example, if you are in the root of a repository and run the following commands:
> cd foo/bar/
> git show HEAD:file.php
> echo $?
128
This will return an error because it can't find a file with a relative path. Instead, you can run the command with the full path to the file relative to the repo root:
> cd foo/bar/
> git show HEAD:$(git ls-files --full-name file.php)
> echo $?
0
When referencing a file in the remote repository, git requires that you specify the full path to the file.
For example, if you are in the root of a repository and run the following commands:
This will return an error because it can't find a file with a relative path. Instead, you can run the command with the full path to the file relative to the repo root:
For the
git show
command,phpcs-changed
already does this thanks to the work done in https://github.com/sirbrillig/phpcs-changed/pull/18. However, thegit cat-file
command, added later in https://github.com/sirbrillig/phpcs-changed/pull/28 does not use that strategy, which means it will not work outside of the repository root.In this PR we alter
git cat-file
to also use the full path name.Fixes https://github.com/sirbrillig/phpcs-changed/issues/66