Git development
 help / color / mirror / Atom feed
* git hook question
@ 2026-05-29  5:01 Wesley Schwengle
  2026-05-29  5:21 ` Jeff King
  0 siblings, 1 reply; 10+ messages in thread
From: Wesley Schwengle @ 2026-05-29  5:01 UTC (permalink / raw)
  To: Git maillinglist


Hello,

I added the following to my gitconfig:

hook.npm-test.event=pre-push
hook.npm-test.command=npm run test

This works well when I run `git hook run pre-push' but when using `git 
push' this breaks a little because it adds the remote and the location, 
as seen via `GIT_TRACE=1 git push origin':

00:46:53.714453 run-command.c:673       trace: run_command: 'npm run 
test' origin git@gitlab.com:waterkip/mything.git
00:46:53.714458 run-command.c:765       trace: start_command: /bin/sh -c 
'npm run test "$@"' 'npm run test' origin 
git@gitlab.com:waterkip/mything.git

I understand the why, normally pre-push gets `<local-ref> SP 
<local-object-name> SP <remote-ref> SP <remote-object-name> LF'. This 
has a similar feel, albeit a different syntax. The difference feels like 
a minor bug, but not one I'm worried about at this moment: you would 
expect it to get the same arguments/parameters as the regular pre-push 
hook. But I digress.

My actual question is: Is there a way to tell the hook "Don't give me 
arguments, just run the plain command that is defined". I looked in `man 
1 git-hook', but I was unable to find something that looks like it.


Cheers,
Wesley

-- 
Wesley Schwengle


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2026-06-03 13:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-29  5:01 git hook question Wesley Schwengle
2026-05-29  5:21 ` Jeff King
2026-05-29 16:11   ` Wesley Schwengle
2026-05-29 16:22     ` Wesley
2026-05-29 17:52     ` Ben Knoble
2026-05-29 19:23     ` Jeff King
     [not found]       ` <4d938e1e-fdd3-42d6-a879-4d394ee8c00d@opperschaap.net>
2026-05-29 21:00         ` Jeff King
2026-06-03 13:07           ` Adrian Ratiu
2026-06-01  5:33   ` Junio C Hamano
2026-06-01  5:55     ` Jeff King

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox