Git Mailing List Archive mirror
 help / color / mirror / Atom feed
From: Eric Sunshine <sunshine@sunshineco.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH 1/6] CodingGuidelines: describe "export VAR=VAL" rule
Date: Sat, 6 Apr 2024 01:11:29 -0400	[thread overview]
Message-ID: <CAPig+cRjqe-rgYf5UZr9KXmfSw98ZoYjPo5PKhwzRaC-svwshA@mail.gmail.com> (raw)
In-Reply-To: <20240406000902.3082301-2-gitster@pobox.com>

On Fri, Apr 5, 2024 at 8:09 PM Junio C Hamano <gitster@pobox.com> wrote:
> https://lore.kernel.org/git/201307081121.22769.tboegi@web.de/
> resulted in 9968ffff (test-lint: detect 'export FOO=bar',
> 2013-07-08) to add a rule to t/check-non-portable-shell.pl script to
> reject
>
>         export VAR=VAL
>
> and suggest us to instead write it as "export VAR" followed by
> "VAR=VAL".  This however was not spelled out in the CodingGuidelines
> document.

I suspect you meant:

   ... and suggest us to instead write it as "VAR=VAL" followed by
   "export VAR".

> We may want to re-evaluate the rule since it is from ages ago, but
> for now, let's make the written rule and what the automation enforces
> consistent.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> @@ -188,6 +188,12 @@ For shell scripts specifically (not exhaustive):
>     hopefully nobody starts using "local" before they are reimplemented
>     in C ;-)
>
> + - Some versions of shell do not understand "export variable=value",
> +   so we write "export variable" and "variable=value" on separae

s/separae/separate/

Here too, it might be clearer to swap around the pieces:

    ... so we write "variable=value" and "export variable" on...

> +   lines.  Note that this was reported in 2013 and the situation might
> +   have changed since then.  We'd need to re-evaluate this rule,
> +   together with the rule in t/check-non-portable-shell.pl script.

The bit starting at "Note that..." seems more appropriate for the
commit message (which is already the case) or a To-Do list. People
reading this document are likely newcomers looking for concrete
instructions about how to code for this project, and this sort of
To-Do item isn't going to help them. (If anything, it might confuse
them into ignoring the advice to split `export foo=bar` into two
statements, which will result in reviewers asking them to reroll.)

  reply	other threads:[~2024-04-06  5:11 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06  0:08 [PATCH 0/6] local VAR="VAL" Junio C Hamano
2024-04-06  0:08 ` [PATCH 1/6] CodingGuidelines: describe "export VAR=VAL" rule Junio C Hamano
2024-04-06  5:11   ` Eric Sunshine [this message]
2024-04-06  5:47     ` Junio C Hamano
2024-04-06  9:15     ` Andreas Schwab
2024-04-06 17:03       ` Junio C Hamano
2024-04-06 17:34       ` Eric Sunshine
2024-04-06  0:08 ` [PATCH 2/6] CodingGuidelines: quote assigned value in 'local var=$val' Junio C Hamano
2024-04-06  1:29   ` rsbecker
2024-04-06  2:29     ` Junio C Hamano
2024-04-06  5:16   ` Eric Sunshine
2024-04-06  5:40     ` Junio C Hamano
2024-04-06  0:08 ` [PATCH 3/6] t: local VAR="VAL" (quote positional parameters) Junio C Hamano
2024-04-08 15:30   ` Patrick Steinhardt
2024-04-08 17:23     ` Junio C Hamano
2024-04-06  0:09 ` [PATCH 4/6] t: local VAR="VAL" (quote command substitution) Junio C Hamano
2024-04-06  0:09 ` [PATCH 5/6] t: local VAR="VAL" (quote ${magic-reference}) Junio C Hamano
2024-04-06  0:09 ` [PATCH 6/6] t: teach lint that RHS of 'local VAR=VAL' needs to be quoted Junio C Hamano
2024-04-07  1:43   ` Jeff King
2024-04-08 17:31     ` Junio C Hamano
2024-04-08 20:40       ` Jeff King
2024-04-06  0:23 ` [PATCH 7/6] t0610: local VAR="VAL" fix Junio C Hamano
2024-04-06  0:28 ` [PATCH 8/6] t1016: " 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=CAPig+cRjqe-rgYf5UZr9KXmfSw98ZoYjPo5PKhwzRaC-svwshA@mail.gmail.com \
    --to=sunshine@sunshineco.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.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 read-only IMAP folder(s) and NNTP newsgroup(s).