-
Notifications
You must be signed in to change notification settings - Fork 8
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
Enable running in subdirectories #76
base: main
Are you sure you want to change the base?
Conversation
Thx a ton for this work! I'll hack on it this week and tag a new release |
I also can't think of any reason why this wouldn't be backwards compatible. |
Only thing that jumped out at me is that the new snippet replaces the old one, instead of moving the old one to the list of legacy snippets |
Ah right, I wasn't familiar with that flow yet. I also don't know if |
I've actually never even heard of pushd/popd I'm gonna have to look those up, haha |
They allow you to push a directory on the stack and then pop it off again, returning you to were you were before. This is a reliable way of navigating to and from directories. The added benefit over a simple |
I think it works the same as "cd [folder]" and "cd -"... but it seems pushd and popd are supported on windows |
I think I've got most of our bugs squashed, and the test suite is passing again, but I haven't really set up a test for this specific use case, so let me see if I've got this right: We have a directory that's a git repo, no composer installed, but a series of subdirectories. example:
I think that before we go any further we've got to really talk through our use story. Drafting for now. |
This is our use case, yes. Our repo contains a directory for deployment/infrastructure related files and besides that the directory for the Laravel project. I suggest finishing the PR as it is now. It adds support for the use case where the single repo is not in the root directory without adding much complexity at all or changing anything for existing users. Support for multiple projects in the same repo should be its own PR imho. |
7428f86
to
b90933e
Compare
I think the reason I'm holding off on this is that a real-world use I can see is git worktrees. If someone is using that feature in order to have multiple branches checked out at once (super useful for teams) this would need to be compatible with that. |
What incompatibilities do you foresee? I'm not a regular worktree user, so I would love to know how this PR interacts with that. |
So a work tree allows you to install the repo into an empty folder like using the |
This is a proof of concept for being able to run hooks from a non-project-root directory within the git repository.
Resolves #75.
My testing setup is as follows:
cd .. && mkdir whisky-test && cd whisky-test
(
whisky-test
andwhisky
are now next to eachother)git init
mkdir subdirectory && cd subdirectory
composer install
composer.json
:composer update
vendor/bin/whisky install
whisky.json
to have the pre-commit hooks contain"echo 'Running pre-commit hook'"
.After making changes in the
whisky
source I needed to runcomposer build
to update the symlinked binary so that I could test with it locally.The biggest area that would need improvement that I can think of right now is what the story is for changing subdirectories. On install the subdirectory is now included in the pre-commit script as we need to change working directories (see
Hook.php:134
). Say the directory changes, there is no way or documentation on how to update Whisky's configuration. I suppose checking for existing lines in thepre-commit
file containingvendor/bin/whisky
and updating them would be the solution to this.Please let me know if there's anything I missed or if you would like me to flesh out certain aspects.