{"thread":{"id":"36277","subject":"Git-hooks pre-push script does not receive input on stdin","startedAt":"2014-03-23T00:44:07Z","lastAt":"2014-03-23T19:21:00Z","messageCount":3,"participants":["David Cowden","Torsten Bögershausen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"237410","messageId":"CAC1XvcPshKQXuRPDd8reb6fsDU3BNOsBAUKO25_dVBD331=yRQ@mail.gmail.com","threadId":"36277","inReplyTo":null,"subject":"Git-hooks pre-push script does not receive input on stdin","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-23T00:44:07Z","receivedAt":"2014-03-23T00:44:07Z","isPatch":false,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n\nIs this a bug in git?  Or am I just a shell noob?\n\nThanks in advance,\n\nDavid\n"},{"id":"237412","messageId":"532E8B13.9060402@web.de","threadId":"36277","inReplyTo":"CAC1XvcPshKQXuRPDd8reb6fsDU3BNOsBAUKO25_dVBD331=yRQ@mail.gmail.com","subject":"Re: Git-hooks pre-push script does not receive input on stdin","fromName":"Torsten Bögershausen","fromEmail":"tboegi@web.de","sentAt":"2014-03-23T07:19:47Z","receivedAt":"2014-03-23T07:19:47Z","isPatch":false,"sender":{"key":"tboegi@web.de","avatar":"https://avatars.githubusercontent.com/u/7138363?v=4"},"body":"On 2014-03-23 01.44, David Cowden wrote:\n> http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n> \n> Is this a bug in git?  Or am I just a shell noob?\n> \n> Thanks in advance,\n> \n> David\n\nI assume that you have the right version of Git ?\nYou can look into the source of Git, to be more exact the test suite:\nt/t5571-pre-push-hook.sh\n\nWhen I play a little but with the script,\n(Replace the diff with test_cmp, add a line:\ndiff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh\nindex 6f9916a..01db2fb 100755\n--- a/t/t5571-pre-push-hook.sh\n+++ b/t/t5571-pre-push-hook.sh\n@@ -42,6 +42,7 @@ export COMMIT2\n write_script \"$HOOK\" <<'EOF'\n echo \"$1\" >actual\n echo \"$2\" >>actual\n+echo hello >>actual\n cat >>actual\n EOF\n-------------\nand finally run it like this:\n\ndebug=t verbose=t ./t5571-pre-push-hook.sh  2>&1 | less\nI get something like this:\n\n--- expected    2014-03-23 07:15:58.000000000 +0000\n+++ actual      2014-03-23 07:15:58.000000000 +0000\n@@ -1,3 +1,4 @@\n parent1\n repo1\n+hello\n refs/heads/master 139b20d8e6c5b496de61f033f642d0e3dbff528d refs/heads/foreign d79ce1670bdcb76e6d1da2ae095e890ccb326ae9\nnot ok 4 - push with hook\n#       \n#               git push parent1 master:foreign &&\n#               test_cmp expected actual\n#       \n--------------------------------------------\nSo the question is, if your push simply doesn't have anything to push,\nbecause everything is up to date?\nAnd in this case there is nothing on STDIN?\n\nIf the problem still exists, feel free to post a script how to reproduce it\nhere to the list, t5571 may be a source of inspiration.\n"},{"id":"237422","messageId":"CAC1XvcOCx36yQ0jKwYdRLUBRnac1XmmtORAeoYnocMd8oPbYXg@mail.gmail.com","threadId":"36277","inReplyTo":"532E8B13.9060402@web.de","subject":"Re: Git-hooks pre-push script does not receive input on stdin","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-23T19:21:00Z","receivedAt":"2014-03-23T19:21:00Z","isPatch":false,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"You are correct, it was a misunderstanding on my part.  I have\nsuggested a patch to clarify the pre-push documentation in a separate\nthread.\n\nThanks for pointing that out!\n\nOn Sun, Mar 23, 2014 at 12:19 AM, Torsten Bögershausen <tboegi@web.de> wrote:\n> On 2014-03-23 01.44, David Cowden wrote:\n>> http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n>>\n>> Is this a bug in git?  Or am I just a shell noob?\n>>\n>> Thanks in advance,\n>>\n>> David\n>\n> I assume that you have the right version of Git ?\n> You can look into the source of Git, to be more exact the test suite:\n> t/t5571-pre-push-hook.sh\n>\n> When I play a little but with the script,\n> (Replace the diff with test_cmp, add a line:\n> diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh\n> index 6f9916a..01db2fb 100755\n> --- a/t/t5571-pre-push-hook.sh\n> +++ b/t/t5571-pre-push-hook.sh\n> @@ -42,6 +42,7 @@ export COMMIT2\n>  write_script \"$HOOK\" <<'EOF'\n>  echo \"$1\" >actual\n>  echo \"$2\" >>actual\n> +echo hello >>actual\n>  cat >>actual\n>  EOF\n> -------------\n> and finally run it like this:\n>\n> debug=t verbose=t ./t5571-pre-push-hook.sh  2>&1 | less\n> I get something like this:\n>\n> --- expected    2014-03-23 07:15:58.000000000 +0000\n> +++ actual      2014-03-23 07:15:58.000000000 +0000\n> @@ -1,3 +1,4 @@\n>  parent1\n>  repo1\n> +hello\n>  refs/heads/master 139b20d8e6c5b496de61f033f642d0e3dbff528d refs/heads/foreign d79ce1670bdcb76e6d1da2ae095e890ccb326ae9\n> not ok 4 - push with hook\n> #\n> #               git push parent1 master:foreign &&\n> #               test_cmp expected actual\n> #\n> --------------------------------------------\n> So the question is, if your push simply doesn't have anything to push,\n> because everything is up to date?\n> And in this case there is nothing on STDIN?\n>\n> If the problem still exists, feel free to post a script how to reproduce it\n> here to the list, t5571 may be a source of inspiration.\n>\n"}]}