summaryrefslogtreecommitdiff
path: root/templates/hooks--pre-push.sample
AgeCommit message (Collapse)AuthorFilesLines
2014-12-22pre-push.sample: remove unnecessary and misleading IFS=' 'Libravatar Jim Hill1-1/+0
The sample hook explicitly sets IFS to SP and nothing else so that the "read" used in the per-ref while loop that iterates over "<localref> SP <localsha1> SP <remoteref> SP <remotesha>" records, where we know refs and sha1s will not have SPs, would split them correctly. While this is not wrong per-se, it is not necessary; because we know these fields do not contain HT or LF, either, we can simply leave IFS the default. This will also prevent those who cut and paste from this sample from getting bitten when they write things in the per-ref loop that need splitting with the default $IFS (e.g. use $(git rev-list ...) to produce one-record-per-line output). Signed-off-by: Jim Hill <gjthill@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-09-11pre-push.sample: Write error message to stderrLibravatar W. Trevor King1-1/+1
githooks(5) suggests: Information about why the push is rejected may be sent to the user by writing to standard error. So follow that advice in the sample. Signed-off-by: W. Trevor King <wking@tremily.us> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-08-30fix shell syntax error in templateLibravatar Thorsten Glaser1-0/+1
An if clause must not be empty; add a "colon" command. Signed-off-by: Thorsten Glaser <t.glaser@tarent.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-06-11pre-push.sample: Make the script executableLibravatar Wieland Hoffmann1-0/+0
githooks(5) says that "[...]the .sample files are executable by default" which was not true. Signed-off-by: Wieland Hoffmann <themineo@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-01-18Add sample pre-push hook scriptLibravatar Aaron Schrab1-0/+53
Create a sample of a script for a pre-push hook. The main purpose is to illustrate how a script may parse the information which is supplied to such a hook. The script may also be useful to some people as-is for avoiding to push commits which are marked as a work in progress. Signed-off-by: Aaron Schrab <aaron@schrab.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>