Add --git-path Option for Submodules and Nested Repositories #335
+10
−6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This PR introduces a new
--git-path
option to the Laravel Pint package. The purpose of this feature is to allow users to specify an alternative Git repository working directory when using the--dirty
or--diff
options. This enhancement is particularly useful in projects that contain multiple Git repositories, such as submodules or nested repositories, enabling more granular control over which repository Pint should check for changes.Use Case
In projects with submodules or multiple repositories, the default behavior of Pint relies on the current working directory. This may lead to inaccurate results when checking for changes using
--dirty
or--diff
. With the--git-path
option, users can specify an absolute or relative path to the desired repository, ensuring Pint operates on the correct Git repository.Usage
Details
--git-path
--dirty
or--diff
.--git-path
is not provided, Pint continues to operate based on the current working directory.--git-path
is invalid or does not point to a Git repository, the command will gracefully fallback to the default behavior without throwing an exception, maintaining consistency with the existing package behavior.--git-path
is provided without--dirty
or--diff
, the option is ignored without side effects.