I deploying my app directly from git by post-receive hook. First time I detect branch name then my script do deploy to corresponding path. I using branch detection method described there: https://stackoverflow.com/a/12367999/3877101
Everything works fine until my server must be upgraded to Debian 7 Wheezy. Nowadays I can see this error in git push log:
remote: hooks/post-receive: 6: read: Illegal option -a
remote: hooks/post-receive: 9: hooks/post-receive: Syntax error: redirection unexpected
Hook fails inside the if statement (line 6 in my code), but this statement will be true whether STDIN isn't provided (! -t 0 according to docs). I'm out of ideas, can you help?
EDIT: My code for getting branch name
5 if ! [ -t 0 ]; then
6 read -a ref
7 fi
8
9 IFS='/' read -ra REF <<< "${ref[2]}"
10 branch="${REF[2]}"