Pint Version
1.26.0
PHP Version
8.4.16
Description
I ran into this issue where in CI pint worked fine but on my local it didn't. I'm using git worktrees extensively when developing locally.
Description
When running Pint in a git worktree (where .git is a file pointing to the main repository, not a directory), directory scanning fails to find any files. However, passing files explicitly works correctly.
Environment Details
- macOS (Darwin 25.1.0)
- Git worktree (
.git is a file containing gitdir: /path/to/main/repo/.git/worktrees/...)
- Standard Laravel 11 project structure
Expected Behavior
./vendor/bin/pint app should scan all PHP files in the app directory recursively, regardless of whether the project is in a git worktree.
Actual Behavior
Directory scanning returns 0 files in worktree environments, but works when files are passed explicitly via glob patterns or find.
Workaround
./vendor/bin/pint $(find app routes -name "*.php")
Steps To Reproduce
-
Create a git worktree:
git worktree add ../my-worktree feature-branch
cd ../my-worktree
-
Run Pint on a directory:
./vendor/bin/pint app --test
# Returns: PASS ... 0 files
-
Run Pint with explicit files:
./vendor/bin/pint app/Http/Controllers/*.php --test
# Returns: FAIL ... X files, Y style issues
-
Confirm files exist:
find app -name "*.php" | wc -l
# Returns: 25
Pint Version
1.26.0
PHP Version
8.4.16
Description
I ran into this issue where in CI pint worked fine but on my local it didn't. I'm using git worktrees extensively when developing locally.
Description
When running Pint in a git worktree (where
.gitis a file pointing to the main repository, not a directory), directory scanning fails to find any files. However, passing files explicitly works correctly.Environment Details
.gitis a file containinggitdir: /path/to/main/repo/.git/worktrees/...)Expected Behavior
./vendor/bin/pint appshould scan all PHP files in theappdirectory recursively, regardless of whether the project is in a git worktree.Actual Behavior
Directory scanning returns 0 files in worktree environments, but works when files are passed explicitly via glob patterns or
find.Workaround
./vendor/bin/pint $(find app routes -name "*.php")Steps To Reproduce
Create a git worktree:
git worktree add ../my-worktree feature-branch cd ../my-worktreeRun Pint on a directory:
./vendor/bin/pint app --test # Returns: PASS ... 0 filesRun Pint with explicit files:
Confirm files exist: