{"thread":{"id":"36278","subject":"[PATCH] Clarify pre-push hook documentation","startedAt":"2014-03-23T19:01:07Z","lastAt":"2014-04-08T08:43:49Z","messageCount":10,"participants":["David Cowden","Junio C Hamano","Eric Sunshine","Philip Oakley"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"237420","messageId":"1395601267-78377-1-git-send-email-dcow90@gmail.com","threadId":"36278","inReplyTo":null,"subject":"[PATCH] Clarify pre-push hook documentation","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-23T19:01:07Z","receivedAt":"2014-03-23T19:01:07Z","isPatch":true,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"The documentation as-is does not mention that the pre-push hook is\nexecuted even when there is nothing to push.  This can lead a new\nreader to beilieve there will always be lines fed to the script's\nstanderd input and cause minor confusion as to what is happening\nwhen there are no lines provided to the pre-push script.\n\nSigned-off-by: David Cowden <dcow90@gmail.com>\n---\n\nNotes:\n    c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script\\\n    -does-not-receive-input-via-stdin\n\n Documentation/githooks.txt | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex d954bf6..a28f6f7 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -203,6 +203,10 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n supplied as it was originally given.\n \n+The hook is executed regardless of whether there are changes to push or not.\n+In the event that there are no changes, no data will be provided on the\n+script's standard input.\n+\n If this hook exits with a non-zero status, 'git push' will abort without\n pushing anything.  Information about why the push is rejected may be sent\n to the user by writing to standard error.\n-- \n1.9.1\n"},{"id":"237423","messageId":"1395601709-78479-1-git-send-email-dcow90@gmail.com","threadId":"36278","inReplyTo":"1395601267-78377-1-git-send-email-dcow90@gmail.com","subject":"[PATCH] Clarify pre-push hook documentation","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-23T19:08:29Z","receivedAt":"2014-03-23T19:08:29Z","isPatch":true,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"The documentation as-is does not mention that the pre-push hook is\nexecuted even when there is nothing to push.  This can lead a new\nreader to beilieve there will always be lines fed to the script's\nstanderd input and cause minor confusion as to what is happening\nwhen there are no lines provided to the pre-push script.\n\nSigned-off-by: David Cowden <dcow90@gmail.com>\n---\n\nNotes:\n    c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n\n Documentation/githooks.txt | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex d954bf6..a28f6f7 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -203,6 +203,10 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n supplied as it was originally given.\n \n+The hook is executed regardless of whether there are changes to push or not.\n+In the event that there are no changes, no data will be provided on the\n+script's standard input.\n+\n If this hook exits with a non-zero status, 'git push' will abort without\n pushing anything.  Information about why the push is rejected may be sent\n to the user by writing to standard error.\n-- \n1.9.1\n"},{"id":"237421","messageId":"1395602300-78698-1-git-send-email-dcow90@gmail.com","threadId":"36278","inReplyTo":"1395601267-78377-1-git-send-email-dcow90@gmail.com","subject":"[PATCH] Clarify pre-push hook documentation","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-23T19:18:20Z","receivedAt":"2014-03-23T19:18:20Z","isPatch":true,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"The documentation as-is does not mention that the pre-push hook is\nexecuted even when there is nothing to push.  This can lead a new\nreader to beilieve there will always be lines fed to the script's\nstanderd input and cause minor confusion as to what is happening\nwhen there are no lines provided to the pre-push script.\n\nSigned-off-by: David Cowden <dcow90@gmail.com>\n---\n\nNotes:\n    c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n\n Documentation/githooks.txt | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex d954bf6..a28f6f7 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -203,6 +203,10 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n supplied as it was originally given.\n \n+The hook is executed regardless of whether there are changes to push or not.\n+In the event that there are no changes, no data will be provided on the\n+script's standard input.\n+\n If this hook exits with a non-zero status, 'git push' will abort without\n pushing anything.  Information about why the push is rejected may be sent\n to the user by writing to standard error.\n-- \n1.9.1\n"},{"id":"237427","messageId":"xmqqy500r7xk.fsf@gitster.dls.corp.google.com","threadId":"36278","inReplyTo":"1395601709-78479-1-git-send-email-dcow90@gmail.com","subject":"Re: [PATCH] Clarify pre-push hook documentation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-23T20:12:07Z","receivedAt":"2014-03-23T20:12:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Cowden <dcow90@gmail.com> writes:\n\n> The documentation as-is does not mention that the pre-push hook is\n> executed even when there is nothing to push.  This can lead a new\n> reader to beilieve there will always be lines fed to the script's\n> standerd input and cause minor confusion as to what is happening\n> when there are no lines provided to the pre-push script.\n>\n> Signed-off-by: David Cowden <dcow90@gmail.com>\n> ---\n\nThe \"everything is up to date; no need to have any data sent back to\nthe other end\" is one case two readers of the documentation may\nguess what should happen, one thinking \"we know nothing is\npushed---there is no need to even call pre-push\", the other thinking\n\"we should always call pre-push, and tell it what will be pushed, in\nthis particular case, nothing\".  It is a good change to clarify that\nambiguous expectation with the new paragraph.\n\nAren't there other cases that can invite ambuguous expectations in a\nsimilar way?  For example, when there are differences between what\nthey have and what we are updating it with but the update does not\nfast-forward?\n\n> +The hook is executed regardless of whether there are changes to push or not.\n> +In the event that there are no changes, no data will be provided on the\n> +script's standard input.\n\nWhat I am tryihng to get at is if \"whether there are changes to push\nor not\" is covering only too narrow a subset of cases where the\nreaders may suffer from their expectations.\n\nThanks.\n"},{"id":"237432","messageId":"CAPig+cSCGRkWioaEnCjKS4c981dnCVbeej-9bCTztfc-wnbhbA@mail.gmail.com","threadId":"36278","inReplyTo":"1395601267-78377-1-git-send-email-dcow90@gmail.com","subject":"Re: [PATCH] Clarify pre-push hook documentation","fromName":"Eric Sunshine","fromEmail":"sunshine@sunshineco.com","sentAt":"2014-03-24T01:40:52Z","receivedAt":"2014-03-24T01:40:52Z","isPatch":true,"sender":{"key":"sunshine@sunshineco.com","avatar":"https://avatars.githubusercontent.com/u/163641?v=4"},"body":"On Sun, Mar 23, 2014 at 3:01 PM, David Cowden <dcow90@gmail.com> wrote:\n> The documentation as-is does not mention that the pre-push hook is\n> executed even when there is nothing to push.  This can lead a new\n> reader to beilieve there will always be lines fed to the script's\n> standerd input and cause minor confusion as to what is happening\n\ns/standerd/standard/\n\n> when there are no lines provided to the pre-push script.\n>\n> Signed-off-by: David Cowden <dcow90@gmail.com>\n> ---\n>\n> Notes:\n>     c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script\\\n>     -does-not-receive-input-via-stdin\n>\n>  Documentation/githooks.txt | 4 ++++\n>  1 file changed, 4 insertions(+)\n>\n> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\n> index d954bf6..a28f6f7 100644\n> --- a/Documentation/githooks.txt\n> +++ b/Documentation/githooks.txt\n> @@ -203,6 +203,10 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n>  than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n>  supplied as it was originally given.\n>\n> +The hook is executed regardless of whether there are changes to push or not.\n> +In the event that there are no changes, no data will be provided on the\n> +script's standard input.\n> +\n>  If this hook exits with a non-zero status, 'git push' will abort without\n>  pushing anything.  Information about why the push is rejected may be sent\n>  to the user by writing to standard error.\n> --\n> 1.9.1\n>\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n"},{"id":"237520","messageId":"1395704609-81957-1-git-send-email-dcow90@gmail.com","threadId":"36278","inReplyTo":"1395601267-78377-1-git-send-email-dcow90@gmail.com","subject":"[PATCH v2] Clarify pre-push hook documentation","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-24T23:43:29Z","receivedAt":"2014-03-24T23:43:29Z","isPatch":true,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"The documentation as-is does not mention that the pre-push hook is\nexecuted even when there is nothing to push.  This can lead a new\nreader to believe there will always be lines fed to the script's\nstandard input and cause minor confusion as to what is happening\nwhen there are no lines provided to the pre-push script.\n\nSigned-off-by: David Cowden <dcow90@gmail.com>\n---\n\nNotes:\n    c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n    \n    I'm not sure if I've covered every case here.  If there are more cases to\n    consider, please let me know and I can update to include them.\n\n Documentation/githooks.txt | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex d954bf6..d05b3c5 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -203,6 +203,15 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n supplied as it was originally given.\n \n+The hook is executed regardless of whether changes will actually be pushed or\n+not.  This may happen are when 'git push' is called and:\n+\n+ - the remote ref is already up to date, or\n+ - pushing to the remote ref cannot be handled by a simple fast-forward\n+\n+In other words, the script is called for every push.  In the event that nothing\n+is to be pushed, no data will be provided on the script's standard input.\n+\n If this hook exits with a non-zero status, 'git push' will abort without\n pushing anything.  Information about why the push is rejected may be sent\n to the user by writing to standard error.\n-- \n1.9.1\n"},{"id":"237521","messageId":"1395705088-82216-1-git-send-email-dcow90@gmail.com","threadId":"36278","inReplyTo":"1395704609-81957-1-git-send-email-dcow90@gmail.com","subject":"[PATCH v3] Clarify pre-push hook documentation","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-03-24T23:51:28Z","receivedAt":"2014-03-24T23:51:28Z","isPatch":true,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"The documentation as-is does not mention that the pre-push hook is\nexecuted even when there is nothing to push.  This can lead a new\nreader to believe there will always be lines fed to the script's\nstandard input and cause minor confusion as to what is happening\nwhen there are no lines provided to the pre-push script.\n\nSigned-off-by: David Cowden <dcow90@gmail.com>\n---\n\nNotes:\n    I'm not sure if I've covered every case here.  If there are more cases to\n    consider, please let me know and I can update to include them.\n    \n    c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n\n Documentation/githooks.txt | 9 +++++++++\n 1 file changed, 9 insertions(+)\n\ndiff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\nindex d954bf6..1fd6da9 100644\n--- a/Documentation/githooks.txt\n+++ b/Documentation/githooks.txt\n@@ -203,6 +203,15 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n supplied as it was originally given.\n \n+The hook is executed regardless of whether changes will actually be pushed or\n+not.  This may happen when 'git push' is called and:\n+\n+ - the remote ref is already up to date, or\n+ - pushing to the remote ref cannot be handled by a simple fast-forward\n+\n+In other words, the script is called for every push.  In the event that nothing\n+is to be pushed, no data will be provided on the script's standard input.\n+\n If this hook exits with a non-zero status, 'git push' will abort without\n pushing anything.  Information about why the push is rejected may be sent\n to the user by writing to standard error.\n-- \n1.9.1\n"},{"id":"237671","messageId":"xmqqmwgemceq.fsf@gitster.dls.corp.google.com","threadId":"36278","inReplyTo":"1395705088-82216-1-git-send-email-dcow90@gmail.com","subject":"Re: [PATCH v3] Clarify pre-push hook documentation","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-03-25T17:11:09Z","receivedAt":"2014-03-25T17:11:09Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"David Cowden <dcow90@gmail.com> writes:\n\n> The documentation as-is does not mention that the pre-push hook is\n> executed even when there is nothing to push.  This can lead a new\n> reader to believe there will always be lines fed to the script's\n> standard input and cause minor confusion as to what is happening\n> when there are no lines provided to the pre-push script.\n>\n> Signed-off-by: David Cowden <dcow90@gmail.com>\n> ---\n>\n> Notes:\n>     I'm not sure if I've covered every case here.  If there are more cases to\n>     consider, please let me know and I can update to include them.\n\nI do not think of any offhand, but a more important point that I was\ntrying to get at was that we should not give an incorrect impression\nto the readers that the scenario that is described is the only case\nthey need to be worried about by pretending to be exhaustive.\n\nThe \"may\" in your wording \"This may happen when\" may be good enough\nto hint that these may not be the only cases.\n\n>     c.f. http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n>\n>  Documentation/githooks.txt | 9 +++++++++\n>  1 file changed, 9 insertions(+)\n>\n> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\n> index d954bf6..1fd6da9 100644\n> --- a/Documentation/githooks.txt\n> +++ b/Documentation/githooks.txt\n> @@ -203,6 +203,15 @@ SHA-1>` will be 40 `0`.  If the local commit was specified by something other\n>  than a name which could be expanded (such as `HEAD~`, or a SHA-1) it will be\n>  supplied as it was originally given.\n>  \n> +The hook is executed regardless of whether changes will actually be pushed or\n> +not.  This may happen when 'git push' is called and:\n> +\n> + - the remote ref is already up to date, or\n> + - pushing to the remote ref cannot be handled by a simple fast-forward\n> +\n> +In other words, the script is called for every push.  In the event that nothing\n> +is to be pushed, no data will be provided on the script's standard input.\n\nWhen two things are to be pushed, the script will see the two\nthings.  When one thing is to be pushed, the script will see the one\nthing.  When no thing is to be pushed, the script will see no thing\non its standard input.\n\nBut isn't that obvious?  I still wonder if we really need to single\nout that \"nothing\" case.  The more important thing is that it is\ninvoked even in the \"0-thing pushed\" case, and \"the list of things\npushed that is given to the hook happens to be empty\" is an obvious\nnatural fallout.\n\n>  If this hook exits with a non-zero status, 'git push' will abort without\n>  pushing anything.  Information about why the push is rejected may be sent\n>  to the user by writing to standard error.\n"},{"id":"237879","messageId":"3CA35D0B7B7C411292360D1516EF409B@PhilipOakley","threadId":"36278","inReplyTo":"xmqqmwgemceq.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH v3] Clarify pre-push hook documentation","fromName":"Philip Oakley","fromEmail":"philipoakley@iee.org","sentAt":null,"receivedAt":"2014-03-26T23:18:30Z","isPatch":true,"sender":{"key":"philipoakley@iee.email","avatar":"https://avatars.githubusercontent.com/u/914343?v=4"},"body":"From: \"Junio C Hamano\" <gitster@pobox.com>\n> David Cowden <dcow90@gmail.com> writes:\n>\n>> The documentation as-is does not mention that the pre-push hook is\n>> executed even when there is nothing to push.  This can lead a new\n>> reader to believe there will always be lines fed to the script's\n>> standard input and cause minor confusion as to what is happening\n>> when there are no lines provided to the pre-push script.\n>>\n>> Signed-off-by: David Cowden <dcow90@gmail.com>\n>> ---\n>>\n>> Notes:\n>>     I'm not sure if I've covered every case here.  If there are more\n>> cases to\n>>     consider, please let me know and I can update to include them.\n>\n> I do not think of any offhand, but a more important point that I was\n> trying to get at was that we should not give an incorrect impression\n> to the readers that the scenario that is described is the only case\n> they need to be worried about by pretending to be exhaustive.\n>\n> The \"may\" in your wording \"This may happen when\" may be good enough\n> to hint that these may not be the only cases.\n>\n>>     c.f.\n>> http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n>>\n>>  Documentation/githooks.txt | 9 +++++++++\n>>  1 file changed, 9 insertions(+)\n>>\n>> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\n>> index d954bf6..1fd6da9 100644\n>> --- a/Documentation/githooks.txt\n>> +++ b/Documentation/githooks.txt\n>> @@ -203,6 +203,15 @@ SHA-1>` will be 40 `0`.  If the local commit was\n>> specified by something other\n>>  than a name which could be expanded (such as `HEAD~`, or a SHA-1) it\n>> will be\n>>  supplied as it was originally given.\n>>\n>> +The hook is executed regardless of whether changes will actually be\n>> pushed or\n>> +not.  This may happen when 'git push' is called and:\n>> +\n>> + - the remote ref is already up to date, or\n>> + - pushing to the remote ref cannot be handled by a simple\n>> fast-forward\n>> +\n>> +In other words, the script is called for every push.  In the event\n>> that nothing\n>> +is to be pushed, no data will be provided on the script's standard\n>> input.\n\nDoesn't an 'in other words' indicate it could be further tightened?\nMaybe\n    \"If there is nothing to push, the hook will still run, but the input\n    line will be empty.\n\n    Likewise the hook will still run for other cases such as:\n    - the remote ref is already up to date,\n    - pushing to the remote ref cannot be handled by a simple\n      fast-forward,\n    - etc.\"\n\n>\n> When two things are to be pushed, the script will see the two\n> things.  When one thing is to be pushed, the script will see the one\n> thing.  When no thing is to be pushed, the script will see no thing\n> on its standard input.\n>\n> But isn't that obvious?  I still wonder if we really need to single\n> out that \"nothing\" case.  The more important thing is that it is\n> invoked even in the \"0-thing pushed\" case, and \"the list of things\n> pushed that is given to the hook happens to be empty\" is an obvious\n> natural fallout.\n\nPersonally I think it should be mentioned in that paragraph, which is\ncovering all the various special cases. The 'nothing' case often causes\nconfusion when it's not specified in documentation.\n>\n>>  If this hook exits with a non-zero status, 'git push' will abort\n>> without\n>>  pushing anything.  Information about why the push is rejected may be\n>> sent\n>>  to the user by writing to standard error.\n> --\n\nIt may be that the documentation should include the caveat\n\n    \"Hooks, when enabled, are executed unconditionally by their calling\n    functions.\n     Script writers should ensure they handle all conditions.\"\n\nsomewhere near the top of the page to cover all hooks, which IIRC\nstarted David's journey. That would allow my second paragraph\n\"Likewise..\" to be dropped.\n\nPhilip\n--\n[apologies for any whitespace damage]\n"},{"id":"238526","messageId":"CAC1XvcMyo4VaJv4bzP+isMoUwoW28yz39=kvJz4EmKxF95Gk-w@mail.gmail.com","threadId":"36278","inReplyTo":"3CA35D0B7B7C411292360D1516EF409B@PhilipOakley","subject":"Re: [PATCH v3] Clarify pre-push hook documentation","fromName":"David Cowden","fromEmail":"dcow90@gmail.com","sentAt":"2014-04-08T08:43:49Z","receivedAt":"2014-04-08T08:43:49Z","isPatch":true,"sender":{"key":"dcow90@gmail.com","avatar":"https://gravatar.com/avatar/71b1769a232e5133b6ea7f4715dccf4f4f9105d29ae1fa4daee06938e33ee5e2?d=mp&s=160"},"body":"Hey guys, I was on vacation for a little over a week, I'll be back on\nthis this coming week (haven't forgotten).\n\nDavid\n\nOn Wed, Mar 26, 2014 at 4:21 PM, Philip Oakley <philipoakley@iee.org> wrote:\n> From: \"Junio C Hamano\" <gitster@pobox.com>\n>>\n>> David Cowden <dcow90@gmail.com> writes:\n>>\n>>\n>>> The documentation as-is does not mention that the pre-push hook is\n>>> executed even when there is nothing to push.  This can lead a new\n>>> reader to believe there will always be lines fed to the script's\n>>> standard input and cause minor confusion as to what is happening\n>>> when there are no lines provided to the pre-push script.\n>>>\n>>> Signed-off-by: David Cowden <dcow90@gmail.com>\n>>> ---\n>>>\n>>> Notes:\n>>>     I'm not sure if I've covered every case here.  If there are more\n>>> cases to\n>>>     consider, please let me know and I can update to include them.\n>>\n>>\n>> I do not think of any offhand, but a more important point that I was\n>> trying to get at was that we should not give an incorrect impression\n>> to the readers that the scenario that is described is the only case\n>> they need to be worried about by pretending to be exhaustive.\n>>\n>> The \"may\" in your wording \"This may happen when\" may be good enough\n>> to hint that these may not be the only cases.\n>>\n>>>     c.f.\n>>>\n>>> http://stackoverflow.com/questions/22585091/git-hooks-pre-push-script-does-not-receive-input-via-stdin\n>>>\n>>>  Documentation/githooks.txt | 9 +++++++++\n>>>  1 file changed, 9 insertions(+)\n>>>\n>>> diff --git a/Documentation/githooks.txt b/Documentation/githooks.txt\n>>> index d954bf6..1fd6da9 100644\n>>> --- a/Documentation/githooks.txt\n>>> +++ b/Documentation/githooks.txt\n>>> @@ -203,6 +203,15 @@ SHA-1>` will be 40 `0`.  If the local commit was\n>>> specified by something other\n>>>  than a name which could be expanded (such as `HEAD~`, or a SHA-1) it\n>>> will be\n>>>  supplied as it was originally given.\n>>>\n>>> +The hook is executed regardless of whether changes will actually be\n>>> pushed or\n>>> +not.  This may happen when 'git push' is called and:\n>>> +\n>>> + - the remote ref is already up to date, or\n>>> + - pushing to the remote ref cannot be handled by a simple\n>>> fast-forward\n>>> +\n>>> +In other words, the script is called for every push.  In the event\n>>> that nothing\n>>> +is to be pushed, no data will be provided on the script's standard\n>>> input.\n>\n>\n> Doesn't an 'in other words' indicate it could be further tightened?\n> Maybe\n>    \"If there is nothing to push, the hook will still run, but the input\n>    line will be empty.\n>\n>    Likewise the hook will still run for other cases such as:\n>\n>    - the remote ref is already up to date,\n>    - pushing to the remote ref cannot be handled by a simple\n>      fast-forward,\n>    - etc.\"\n>\n>\n>>\n>> When two things are to be pushed, the script will see the two\n>> things.  When one thing is to be pushed, the script will see the one\n>> thing.  When no thing is to be pushed, the script will see no thing\n>> on its standard input.\n>>\n>> But isn't that obvious?  I still wonder if we really need to single\n>> out that \"nothing\" case.  The more important thing is that it is\n>> invoked even in the \"0-thing pushed\" case, and \"the list of things\n>> pushed that is given to the hook happens to be empty\" is an obvious\n>> natural fallout.\n>\n>\n> Personally I think it should be mentioned in that paragraph, which is\n> covering all the various special cases. The 'nothing' case often causes\n> confusion when it's not specified in documentation.\n>>\n>>\n>>>  If this hook exits with a non-zero status, 'git push' will abort\n>>> without\n>>>  pushing anything.  Information about why the push is rejected may be\n>>> sent\n>>>  to the user by writing to standard error.\n>>\n>> --\n>\n>\n> It may be that the documentation should include the caveat\n>\n>    \"Hooks, when enabled, are executed unconditionally by their calling\n>    functions.\n>     Script writers should ensure they handle all conditions.\"\n>\n> somewhere near the top of the page to cover all hooks, which IIRC\n> started David's journey. That would allow my second paragraph\n> \"Likewise..\" to be dropped.\n>\n> Philip\n> --\n> [apologies for any whitespace damage]\n>\n"}]}