-
Notifications
You must be signed in to change notification settings - Fork 6
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
pre-push hook error - no arguments expected #31
Comments
And my pre-push hook looks like this, it's a very simple implementation but works for now. <?php
namespace App\Console\GitHooks;
use Closure;
use Igorsgm\GitHooks\Contracts\PrePushHook;
use Igorsgm\GitHooks\Exceptions\HookFailException;
use Igorsgm\GitHooks\Git\Log;
use Illuminate\Support\Facades\Artisan;
class PestPrePushHook implements PrePushHook
{
/**
* Get the name of the hook.
*/
public function getName(): ?string
{
return 'Pest Pre Push Hook';
}
/**
* Execute the Hook.
*
* @param Log $log
* @param Closure $next The next hook in the chain to execute.
* @return mixed|null
*/
public function handle(Log $log, Closure $next)
{
$return = Artisan::call("test");
if ($return !== 0) {
throw new HookFailException("Tests failed");
}
// Run the next hook in the chain
return $next($log);
}
} And #!/bin/sh
# Detect whether /dev/tty is available & functional
if sh -c ": >/dev/tty" >/dev/null 2>/dev/null; then
exec < /dev/tty
fi
php /home/rasmus/xxxxxxxx/xxxxxxxxxxxxxxxxxxxx/artisan git-hooks:pre-push $@ >&2 |
Seems like this is the same error as in #24 sorry for opening a new issue about the same error. I thought I looked through the open issues but I must have been tired or something. |
I have exactly the same issue. I thought I was going crazy. For whatever reason - pre-commit works just fine. But pre-push always runs into this issue no matter how I try circumvent it. |
Just a note for anyone encountering this issue, you can circumvent the hooks with |
Based on https://git-scm.com/docs/githooks#_pre_push.
I think this could fixed with the following but I haven't had the chance to test it yet. If it works I'll create a PR, there might be some other hooks affected by the same bug also.
*
* @var string
*/
- protected $signature = 'git-hooks:pre-push';
+ protected $signature = 'git-hooks:pre-push {remote?} {url?}';
/**
* The console command description. |
same for me |
I completely forgot about this, but I'll create a PR this weekend to fix this issue. |
If the commands are run with extra arguments without them being defined the command fails. This fix allows calling the `pre-push` and `prepare-commit-msg` hooks with all their arguments while still retaining the old behavior since the arguments are optional. Reference: https://git-scm.com/book/en/v2/Customizing-Git-Git-Hooks closes igorsgm#31
I have a pre-push hook which runs my tests and it works with
php artisan git-hooks:pre-push
command, but when actually pushing with the commandgit push
I get the following error:The text was updated successfully, but these errors were encountered: