bash - Git-hooks pre-push script does not receive input via STDIN -


the git-hooks pre-push documentation states first line of stdin populated local ref , sha, , remote ref , sha such:

<local ref> sp <local sha1> sp <remote ref> sp <remote sha1> lf

however, simple pre-push script:

#!/bin/bash  echo "params=[$@]"  read line echo "stdin=[$line]"  exit 1 

returns following output when $git push run:

params=[origin [url]:[branch].git] stdin=[] error: failed push refs '[remote]' 

the parameters script specified in documentation (name , path of remote). error expected because script exits status of 1. however, can't seem figure out why i'm not receiving local , remote refs on stdin specified documentation.

is bug in git? or, missing something?

apologies if stating obvious, if there's nothing push, won't lines on stdin. sample .git/hooks/pre-push.sample has while loop:

ifs=' ' while read local_ref local_sha remote_ref remote_sha     ... done 

and appears work when try here echo inside loop , nothing else - nothing when have nothing push, , output when do.


Comments

Popular posts from this blog

php - Magento - Deleted Base url key -

javascript - Tooltipster plugin not firing jquery function when button or any click even occur -

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -