Skip to content

Commit 3af74cf

Browse files
jthillgitster
authored andcommitted
pre-push.sample: remove unnecessary and misleading IFS=' '
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent bef111d commit 3af74cf

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

templates/hooks--pre-push.sample

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ url="$2"
2424

2525
z40=0000000000000000000000000000000000000000
2626

27-
IFS=' '
2827
while read local_ref local_sha remote_ref remote_sha
2928
do
3029
if [ "$local_sha" = $z40 ]

0 commit comments

Comments
 (0)