git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Git-hooks pre-push script does not receive input on stdin
@ 2014-03-23  0:44 David Cowden
  2014-03-23  7:19 ` Torsten Bögershausen
  0 siblings, 1 reply; 3+ messages in thread
From: David Cowden @ 2014-03-23  0:44 UTC (permalink / raw)
  To: git

http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin

Is this a bug in git?  Or am I just a shell noob?

Thanks in advance,

David

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Git-hooks pre-push script does not receive input on stdin
  2014-03-23  0:44 Git-hooks pre-push script does not receive input on stdin David Cowden
@ 2014-03-23  7:19 ` Torsten Bögershausen
  2014-03-23 19:21   ` David Cowden
  0 siblings, 1 reply; 3+ messages in thread
From: Torsten Bögershausen @ 2014-03-23  7:19 UTC (permalink / raw)
  To: David Cowden, git

On 2014-03-23 01.44, David Cowden wrote:
> http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin
> 
> Is this a bug in git?  Or am I just a shell noob?
> 
> Thanks in advance,
> 
> David

I assume that you have the right version of Git ?
You can look into the source of Git, to be more exact the test suite:
t/t5571-pre-push-hook.sh

When I play a little but with the script,
(Replace the diff with test_cmp, add a line:
diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
index 6f9916a..01db2fb 100755
--- a/t/t5571-pre-push-hook.sh
+++ b/t/t5571-pre-push-hook.sh
@@ -42,6 +42,7 @@ export COMMIT2
 write_script "$HOOK" <<'EOF'
 echo "$1" >actual
 echo "$2" >>actual
+echo hello >>actual
 cat >>actual
 EOF
-------------
and finally run it like this:

debug=t verbose=t ./t5571-pre-push-hook.sh  2>&1 | less
I get something like this:

--- expected    2014-03-23 07:15:58.000000000 +0000
+++ actual      2014-03-23 07:15:58.000000000 +0000
@@ -1,3 +1,4 @@
 parent1
 repo1
+hello
 refs/heads/master 139b20d8e6c5b496de61f033f642d0e3dbff528d refs/heads/foreign d79ce1670bdcb76e6d1da2ae095e890ccb326ae9
not ok 4 - push with hook
#       
#               git push parent1 master:foreign &&
#               test_cmp expected actual
#       
--------------------------------------------
So the question is, if your push simply doesn't have anything to push,
because everything is up to date?
And in this case there is nothing on STDIN?

If the problem still exists, feel free to post a script how to reproduce it
here to the list, t5571 may be a source of inspiration.

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Git-hooks pre-push script does not receive input on stdin
  2014-03-23  7:19 ` Torsten Bögershausen
@ 2014-03-23 19:21   ` David Cowden
  0 siblings, 0 replies; 3+ messages in thread
From: David Cowden @ 2014-03-23 19:21 UTC (permalink / raw)
  To: Torsten Bögershausen; +Cc: git

You are correct, it was a misunderstanding on my part.  I have
suggested a patch to clarify the pre-push documentation in a separate
thread.

Thanks for pointing that out!

On Sun, Mar 23, 2014 at 12:19 AM, Torsten Bögershausen <tboegi@web.de> wrote:
> On 2014-03-23 01.44, David Cowden wrote:
>> http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin
>>
>> Is this a bug in git?  Or am I just a shell noob?
>>
>> Thanks in advance,
>>
>> David
>
> I assume that you have the right version of Git ?
> You can look into the source of Git, to be more exact the test suite:
> t/t5571-pre-push-hook.sh
>
> When I play a little but with the script,
> (Replace the diff with test_cmp, add a line:
> diff --git a/t/t5571-pre-push-hook.sh b/t/t5571-pre-push-hook.sh
> index 6f9916a..01db2fb 100755
> --- a/t/t5571-pre-push-hook.sh
> +++ b/t/t5571-pre-push-hook.sh
> @@ -42,6 +42,7 @@ export COMMIT2
>  write_script "$HOOK" <<'EOF'
>  echo "$1" >actual
>  echo "$2" >>actual
> +echo hello >>actual
>  cat >>actual
>  EOF
> -------------
> and finally run it like this:
>
> debug=t verbose=t ./t5571-pre-push-hook.sh  2>&1 | less
> I get something like this:
>
> --- expected    2014-03-23 07:15:58.000000000 +0000
> +++ actual      2014-03-23 07:15:58.000000000 +0000
> @@ -1,3 +1,4 @@
>  parent1
>  repo1
> +hello
>  refs/heads/master 139b20d8e6c5b496de61f033f642d0e3dbff528d refs/heads/foreign d79ce1670bdcb76e6d1da2ae095e890ccb326ae9
> not ok 4 - push with hook
> #
> #               git push parent1 master:foreign &&
> #               test_cmp expected actual
> #
> --------------------------------------------
> So the question is, if your push simply doesn't have anything to push,
> because everything is up to date?
> And in this case there is nothing on STDIN?
>
> If the problem still exists, feel free to post a script how to reproduce it
> here to the list, t5571 may be a source of inspiration.
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-23 19:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-23  0:44 Git-hooks pre-push script does not receive input on stdin David Cowden
2014-03-23  7:19 ` Torsten Bögershausen
2014-03-23 19:21   ` David Cowden

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).