git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2] CodingGuidelines: explicitly allow "local" for test scripts

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 3, 2021, 09:01 UTC
Message-ID
<877dkgxk9p.fsf@evledraar.gmail.com>
In-Reply-To
<xmqqo8ds8k6r.fsf_-_@gitster.g>
On Mon, May 03 2021, Junio C Hamano wrote:
Show 30 quoted lines
> 01d3a526 (t0000: check whether the shell supports the "local"
> keyword, 2017-10-26) raised a test balloon to see if those who build
> and test Git use a platform with a shell that lacks support for the
> "local" keyword.  After two years, 7f0b5908 (t0000: reword comments
> for "local" test, 2019-08-08) documented that "local" keyword, even
> though is outside POSIX, is allowed in our test scripts.
>
> Let's write it in the CodingGuidelines, too.  It might be tempting
> to allow it in scripted Porcelains (we have avoided getting them
> contaminiated by "local" so far), but they are on their way out and
> getting rewritten in C.
>
> Signed-off-by: Junio C Hamano <gitster@pobox.com>
> ---
>  Documentation/CodingGuidelines | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines
> index 45465bc0c9..ea70676a30 100644
> --- a/Documentation/CodingGuidelines
> +++ b/Documentation/CodingGuidelines
> @@ -175,6 +175,11 @@ For shell scripts specifically (not exhaustive):
>  
>     does not have such a problem.
>  
> + - Even though "local" is not part of POSIX, we make heavy use of it
> +   in our test suite.  We do not use it in scripted Porcelains, and
> +   hopefully nobody starts using "local" before they are reimplemented
> +   in C ;-)
> +

Is there any portability reason to avoid "local" in the porcelains? I don't have any plans for using it, but I don't see why we'd explicitly forbid it.

Previous: Junio C HamanoNext: Junio C Hamano
Message 5 of 17 in “CodingGuidelines: explicitly allow "local" for test scripts”
  1. CodingGuidelines: explicitly allow "local" for test scriptsJunio C Hamano, May 3, 2021
  2. Eric SunshineMay 3, 2021
  3. Junio C HamanoMay 3, 2021
  4. CodingGuidelines: explicitly allow "local" for test scriptsJunio C Hamano, May 3, 2021
  5. Ævar Arnfjörð BjarmasonMay 3, 2021
  6. Junio C HamanoMay 4, 2021
  7. Ævar Arnfjörð BjarmasonMay 4, 2021
  8. Junio C HamanoMay 4, 2021
  9. Ævar Arnfjörð BjarmasonMay 4, 2021
  10. Felipe ContrerasMay 4, 2021
  11. brian m. carlsonMay 4, 2021
  12. Junio C HamanoMay 4, 2021
  13. Felipe ContrerasMay 5, 2021
  14. brian m. carlsonMay 5, 2021
  15. Felipe ContrerasMay 5, 2021
  16. Jeff KingMay 5, 2021
  17. Felipe ContrerasMay 5, 2021

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.