git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Tim Henigan <tim.henigan@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 2/2] CodingGuidelines: Add note forbidding use of 'which' in shell scripts
Date: Mon, 27 Feb 2012 10:56:50 -0800	[thread overview]
Message-ID: <7vty2c85ql.fsf@alter.siamese.dyndns.org> (raw)
In-Reply-To: <1330117921-8257-2-git-send-email-tim.henigan@gmail.com> (Tim Henigan's message of "Fri, 24 Feb 2012 16:12:01 -0500")

Tim Henigan <tim.henigan@gmail.com> writes:

> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index a4ffe7c..3505a4b 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -44,6 +44,10 @@ For shell scripts specifically (not exhaustive):
>     properly nests.  It should have been the way Bourne spelled
>     it from day one, but unfortunately isn't.
>  
> + - The use of 'which' is not allowed.  The output of 'which' is not
> +   machine parseable and its exit code is not reliable across
> +   platforms.

It is more helpful to say "If you want to do Z, use X, not Y because Y is
broken for such and such reasons", rather than "Never use Y because Y is
broken ...".

In this case, Z is "find out if a command is available on user's $PATH",
and X is "type", I think.

  reply	other threads:[~2012-02-27 18:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-24 21:12 [PATCH 1/2] CodingGuidelines: Add a note about spaces after redirection Tim Henigan
2012-02-24 21:12 ` [PATCH 2/2] CodingGuidelines: Add note forbidding use of 'which' in shell scripts Tim Henigan
2012-02-27 18:56   ` Junio C Hamano [this message]
2012-02-27 18:55 ` [PATCH 1/2] CodingGuidelines: Add a note about spaces after redirection Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7vty2c85ql.fsf@alter.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=tim.henigan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).