Re: [PATCH v2] CodingGuidelines: explicitly allow "local" for test scripts
- From
Felipe Contreras <felipe.contreras@gmail.com>
- Date
- May 4, 2021, 20:22 UTC
- Message-ID
- <6091ad06cecb0_b34a8208bf@natae.notmuch>
- In-Reply-To
- <87a6pawmyu.fsf@evledraar.gmail.com>
Ævar Arnfjörð Bjarmason wrote:
Show 12 quoted lines
> On Tue, May 04 2021, Junio C Hamano wrote: > > Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes: > > > >> It's effectively synonymous with saying "we still want to support git on > >> platforms that are so broken they can't even run a single test in our > >> test suite". > > > > Not really. Those on such a platform would (rightly) say that it is > > the test suite that is broken and out of compliance. > > Indeed. But the lack of any reports about that suggests that in practice > this is universally supported enough to be a hard dependency.
It is universally supported but not always in the same way, which is why it hasn't managed to become part of POSIX.
I for example stumbled upon an issue where 'local x' does not work the same in bash and zsh, triggering a huge discussion on the zsh mailing list.
However, if you set a value (e.g. 'local x=') then you shouldn't have any problems.
f () { local x; echo ${x-unset}; }; f # this behavior variesFor a full discussion check [1].
[1] https://www.austingroupbugs.net/bug_view_page.php?bug_id=767
-- Felipe Contreras