pre-push.sample: remove unnecessary and misleading IFS=' '
authorJim Hill <gjthill@gmail.com>
Sun, 21 Dec 2014 19:26:00 +0000 (11:26 -0800)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Dec 2014 18:27:42 +0000 (10:27 -0800)
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>
templates/hooks--pre-push.sample
index 69e3c67b00f482449e77945eb114f58244078b1e..6187dbf4390fc6e28445dd3d988aefb9d1111988 100755 (executable)
@@ -24,7 +24,6 @@ url="$2"
 
 z40=0000000000000000000000000000000000000000
 
-IFS=' '
 while read local_ref local_sha remote_ref remote_sha
 do
        if [ "$local_sha" = $z40 ]