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

[ Bug ] Unhandled behaviour when switching to branch without whisky #62

Open
ProjektGopher opened this issue Aug 17, 2023 · 0 comments
Open

Comments

@ProjektGopher
Copy link
Owner

ProjektGopher commented Aug 17, 2023

Whisky installed globally, but switched to branch where whisky has not been required through composer, and whisky.json is not present, however the hooks have been installed.

Because the hooks directory, and the vendor bin directory remain untouched when switching between branches, we can still run whisky, but get the following output:

❯ git hook run pre-commit
.git/hooks/pre-commit: line 3: In: command not found
does:                                            cannot open `does' (No such file or directory)
not:                                             cannot open `not' (No such file or directory)
exist:                                           cannot open `exist' (No such file or directory)
at:                                              cannot open `at' (No such file or directory)
path:                                            cannot open `path' (No such file or directory)
/Users/gopher/Code/EXACTsports/camps/whisky.jso: cannot open `/Users/gopher/Code/EXACTsports/camps/whisky.jso' (No such file or directory)
.git/hooks/pre-commit: line 6: n.: command not found

both global whisky, and vendor/bin/whisky run, returning the correct version.

This should be as easy as having the get-run-cmd Command check for whisky.json just like the Install/Uninstall/Update commands do.

❯ ./vendor/bin/whisky get-run-cmd pre-commit

In Filesystem.php line 59:
                                                                                 
  File does not exist at path /Users/gopher/Code/EXACTsports/camps/whisky.json.  
                                                                                 

edit:
I think we could take two approaches here. Either fail silently by not returning anything in the get-run-cmd output, or we'll have to rewrite the snippet that gets added to the git hook file, and support another new snippet in Whisky::isInstalled() et all. This could be a bit tougher due to the multi-line nature the new snippet would implement. Needs discussion.

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

No branches or pull requests

1 participant