git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Stefan Beller <stefanbeller@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 4/8] CodingGuidelines: give an example for control statements
Date: Wed, 30 Apr 2014 15:03:25 -0700	[thread overview]
Message-ID: <xmqqwqe6cw5u.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <5361711F.1030208@gmail.com> (Stefan Beller's message of "Wed, 30 Apr 2014 23:54:39 +0200")

Stefan Beller <stefanbeller@gmail.com> writes:

> On 30.04.2014 23:45, Junio C Hamano wrote:
>> Signed-off-by: Junio C Hamano <gitster@pobox.com>
>> ---
>>  Documentation/CodingGuidelines | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>> 
>> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
>> index 1e0c4cf..d72e912 100644
>> --- a/Documentation/CodingGuidelines
>> +++ b/Documentation/CodingGuidelines
>> @@ -97,6 +97,17 @@ For shell scripts specifically (not exhaustive):
>>     "then" should be on the next line for if statements, and "do"
>>     should be on the next line for "while" and "for".
>>  
>> +	(incorrect)
>
> At the other patches you used #comments behind oneliners,
> not sure if that's also suitable here for consistency of the documentation.

I think you meant this one (are there others?):

+	cat hello > world < universe	# incorrect
+	cat hello >world <universe	# correct
+
+	echo hello >$world		# incorrect
+	echo hello >"$world"		# correct
+

I can certainly go with this instead over there:

	(incorrect)
	cat hello > world < universe
	echo hello >$world

	(correct)
	cat hello >world <universe
	echo hello >"$world"

I do not think it is wise to use the trailing comment style on all
the incorrect/correct lines for these examples.

>> +	if test -f hello; then
>> +		do this
>> +	fi
>> +
>> +	(correct)
>> +	if test -f hello
>> +	then
>> +		do this
>> +	fi
>> +
>>   - We prefer "test" over "[ ... ]".
>>  
>>   - We do not write the noiseword "function" in front of shell
>> 

  reply	other threads:[~2014-04-30 22:04 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-30 21:45 [PATCH 0/8] Update the CodingGuidelines Junio C Hamano
2014-04-30 21:45 ` [PATCH 1/8] CodingGuidelines: typofix Junio C Hamano
2014-05-01 14:09   ` David Kastrup
2014-05-01 17:51     ` Junio C Hamano
2014-05-01 21:27       ` Jeff King
2014-05-02 18:31         ` Junio C Hamano
2014-05-02 20:33           ` Jeff King
2014-05-02 20:37             ` Felipe Contreras
2014-05-02 20:53               ` David Kastrup
2014-04-30 21:45 ` [PATCH 2/8] CodingGuidelines: give an example for case/esac statement Junio C Hamano
2014-04-30 21:45 ` [PATCH 3/8] CodingGuidelines: give an example for redirection Junio C Hamano
2014-04-30 22:14   ` [PATCH v2 " Junio C Hamano
2014-04-30 21:45 ` [PATCH 4/8] CodingGuidelines: give an example for control statements Junio C Hamano
2014-04-30 21:54   ` Stefan Beller
2014-04-30 22:03     ` Junio C Hamano [this message]
2014-05-01 14:12   ` David Kastrup
2014-05-01 18:00     ` Junio C Hamano
2014-04-30 21:45 ` [PATCH 5/8] CodingGuidelines: give an example for shell function preamble Junio C Hamano
2014-04-30 21:45 ` [PATCH 6/8] CodingGuidelines: call the conditional statement "if ()", not "if()" Junio C Hamano
2014-05-01 14:14   ` David Kastrup
2014-05-01 18:11     ` Junio C Hamano
2014-05-01 18:36       ` David Kastrup
2014-04-30 21:45 ` [PATCH 7/8] CodingGuidelines: on comparison Junio C Hamano
2014-05-01 21:36   ` Jeff King
2014-05-02 18:18     ` Junio C Hamano
2014-05-02 20:31       ` Jeff King
2014-05-02 20:45         ` Junio C Hamano
2014-04-30 21:45 ` [PATCH 8/8] CodingGuidelines: once it is in, it is not worth the code churn Junio C Hamano
2014-05-02 20:51 ` [PATCH 9/8] CodingGuidelines: on splitting a long line Junio C Hamano
2014-05-02 21:00   ` brian m. carlson

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=xmqqwqe6cw5u.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=stefanbeller@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).