pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.42k stars 338 forks source link

The feature "Filter by dirty files" requires "git" #837

Closed jasonmccallister closed 1 year ago

jasonmccallister commented 1 year ago

I get this one randomly through out the day. I'm running my site with ddev and connected via ddev ssh. I can run the command multiple times successfully, but at least ~10 times a day - in the same terminal session - I get the following error:

The feature "Filter by dirty files" requires "git".

This happens when running php artisan test --dirty and ./vendor/bin/pest --dirty.

Details

PHP: 8.2.3 Pest: 2.6.3

owenvoke commented 1 year ago

Hmm, I'm assuming this is due to this check.

It only checks whether the command failed, not whether Git actually exists. So it's probably just that the command returned an invalid exit code, and might be hiding the underlying issue.

jasonmccallister commented 1 year ago

Alright, I edited that file in vendor and added the following:

if (! $process->isSuccessful()) {
    dd($process->getErrorOutput());
    throw new MissingDependency('Filter by dirty files', 'git');
}

I finally hit that error and this is the output:

fatal: detected dubious ownership in repository at '/var/www/html'\n
To add an exception for this directory, call:\n
\n
\tgit config --global --add safe.directory /var/www/html\n
jasonmccallister commented 1 year ago

Running git config --global --add safe.directory /var/www/html does resolve the problem, but it still occurs randomly. I'm assuming this has something to do with ddev and mutagen mounts?

devajmeireles commented 1 year ago

Hey, @jasonmccallister . Thanks for your report.

I was not able to reproduce this, so I assume this issue is specific to your environment. To improve our organization, I will close this topic. Please feel free to open a new topic, whatever you need.

kerunaru commented 2 months ago

@jasonmccallister Just four your information. This happens when Docker mounts the volume with your code; your user used to log in the container differs from the one who creates all the directory hierarchy and git complains about that.