Git development
 help / color / mirror / Atom feed
From: Wesley <wesleys@opperschaap.net>
To: Sean Allred <allred.sean@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: git pre-push hook not getting the lines from STDIN
Date: Wed, 9 Aug 2023 08:38:25 -0400	[thread overview]
Message-ID: <1eef1bff-8b65-abac-e75b-acd98b013e7b@opperschaap.net> (raw)
In-Reply-To: <m0wmy4lbd0.fsf@epic96565.epic.com>


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@gitlab.com:waterkip/zsh (fetch)
origin	git@gitlab.com: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?


      reply	other threads:[~2023-08-09 12:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-08 22:24 git pre-push hook not getting the lines from STDIN Wesley
2023-08-09 11:00 ` Sean Allred
2023-08-09 12:38   ` Wesley [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1eef1bff-8b65-abac-e75b-acd98b013e7b@opperschaap.net \
    --to=wesleys@opperschaap.net \
    --cc=allred.sean@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox