Re: git pre-push hook not getting the lines from STDIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




Hello Sean,

Have you looked at simplifying this script to the bare minimum to
identify the issue? I might suggest starting by just slurping stdin and
writing that to a file:

     #!/bin/sh
     echo "$@" >pre-push.$$.args
     cat >>pre-push.$$.stdin
     exit 1
>
I'm not familiar with the particulars of Zsh scripting, but I suspect
there is a bug in your script. Zsh works with my script, too, so it
doesn't appear to be a problem with Zsh itself.

This is the bare miminum. You can also take the example script from the git sources which does it in bash[^1] and uses while read syntax. It produces the same output, with the exception that you don't see the empty echo statements because it cannot read the input from STDIN and exits immediately.

It seems it works intermittently.

In my zsh repo for example with the following remotes:

origin	git@xxxxxxxxxx:waterkip/zsh (fetch)
origin	git@xxxxxxxxxx:waterkip/zsh (push)
upstream	git://git.code.sf.net/p/zsh/code (fetch)
upstream	git://git.code.sf.net/p/zsh/code (push)

Locally my patchlevel-in_version branch is at commit b7f280ab5. If I `git pull --rebase upstream master` and than push it (`git push origin HEAD) with hook configured it doesn't show any of the things I expect in LOCAL_REF etc. This happens with my version of the script and the version provided by git (in .git/hooks/pre-push.sample).

Cheers,
Wesley

[^1]: https://github.com/git/git/blob/87c86dd14abe8db7d00b0df5661ef8cf147a72a3/templates/hooks--pre-push.sample

--
Wesley

Why not both?




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux