Skip to content

Add a git_hooks_path config key. #33

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

Shkeats
Copy link

@Shkeats Shkeats commented May 23, 2024

Add a git_hooks_path config key that allows a user to point the package to the correct path to place githooks for their project. This should be a non breaking change for existing users due to the default value provided in the config() call.

Motivation:
I wasn't able to get the package working as I was installing it in a git submodules setup where the Laravel project was a submodule in a large project. In that context the correct path for the git hooks is higher in the directory structure. This PR gives package users the option to configure that path so they can use it with git submodules (while keeping the existing default the same.)

CI Fix
The CI was failing already on master for Laravel 9, I've fixed this by adding an appropriate version of orchestra/testbench to the composer.json.

Copy link

what-the-diff bot commented May 23, 2024

PR Summary

  • Update of Testbench versions allowed
    Our project's composer.json file, which helps manage our project dependencies (i.e. other external code we rely on), will now accept versions 7.0.0, 8.0.0, and 9.0.0 of a software testing tool called Testbench. This means we can use newer versions of Testbench in our project, keeping our tools up-to-date.

  • New configuration for Git Hooks storage
    We've added a new configuration option (essentially a value we can set to change the behavior of our software) to the config/git-hooks.php file. This option allows us to specify where we store our Git hooks, which are pieces of code that automate tasks when specific actions occur in our project's Git repository.

  • Modification to GitHooks Directory Retrieval
    Inside src/GitHooks.php (a file where we define how our Git hooks work), we've adjusted the getGitHooksDir() function – a piece of our software responsible for finding where Git hooks are stored. Now, it will use our new 'git_hooks_path' configuration option if it's set; otherwise, revert to the default storage location. This provides more flexibility in how we manage and utilize our Git hooks.

Shkeats added 2 commits May 23, 2024 09:41
…ackage to the correct path to place githooks for your project. This is useful if your project is a git submodule of a bigger project.
@Shkeats Shkeats marked this pull request as ready for review May 23, 2024 08:44
@Shkeats Shkeats changed the title Add a git_hooks_path config variable. Add a git_hooks_path config key. May 28, 2024
@joe-niland
Copy link

@igorsgm I have tested this branch and it helped in my case where we have the Laravel project in src/ but .git/ is in the root

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