Code

CodingGuidelines: do not use 'which' in shell scripts
authorTim Henigan <tim.henigan@gmail.com>
Fri, 24 Feb 2012 23:12:58 +0000 (18:12 -0500)
committerJunio C Hamano <gitster@pobox.com>
Mon, 27 Feb 2012 23:10:23 +0000 (15:10 -0800)
commit860f70f9f4206379361fd5af84c8fde31984b418
tree74806c7f14b85fa2e1075722b49e3c7e75377a1e
parent48f359bfafa7db4c399fa13f17ccfea7c35f333b
CodingGuidelines: do not use 'which' in shell scripts

During the code review of a recent patch, it was noted that shell scripts
must not use 'which $cmd' to check the availability of the command $cmd.
The output of the command is not machine parseable and its exit code is
not reliable across platforms.

It is better to use 'type' to accomplish this task.

Signed-off-by: Tim Henigan <tim.henigan@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/CodingGuidelines