Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add --git-path Option for Submodules and Nested Repositories #335

Closed
wants to merge 2 commits into from

Conversation

dena-a
Copy link

@dena-a dena-a commented Jan 16, 2025

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

# Check for dirty changes in a specific repository
pint --dirty --git-path=/path/to/repo

# Check for diffs in a nested submodule
pint --diff=main --git-path=../submodule

Details

  • New Option: --git-path
    • Specifies the path to an alternative Git repository.
    • Accepts both absolute and relative paths.
    • This option has no effect unless combined with --dirty or --diff.
  • Default Behavior:
    • If --git-path is not provided, Pint continues to operate based on the current working directory.
  • Error Handling:
    • If the provided --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.
  • Compatibility:
    • If --git-path is provided without --dirty or --diff, the option is ignored without side effects.

@taylorotwell
Copy link
Member

Thanks for your pull request to Laravel!

Unfortunately, I'm going to delay merging this code for now. To preserve our ability to adequately maintain the framework, we need to be very careful regarding the amount of code we include.

If applicable, please consider releasing your code as a package so that the community can still take advantage of your contributions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants