Subject: Re: [PATCH 1/7] fsck_tree(): fix shadowed variable

From: Jonathan Nieder <[email-masked]>
Date: Mon, 5 Oct 2020 01:29:52 -0700

Jeff King wrote:
> On Mon, Oct 05, 2020 at 12:44:04AM -0700, Jonathan Nieder wrote:
>> Jeff King wrote:

>>> -		test_i18ngrep gitmodulesSymlink output
>>> +		test_i18ngrep "tree $tree: gitmodulesSymlink" output
>>
>> Makes sense.
>>
>> By the way, why does GETTEXT_POISON lose the gitmodulesSymlink
>> keyword?  Is this just a limitation of GETTEXT_POISON losing
>> information that's passed in with %s?
>
> Yes, I think so. It comes from 674ba34038 (fsck: mark strings for
> translation, 2018-11-10) which is passing through our string. Arguably
> that commit made the comment lines rather confusing and pointless.
>
> Though hmm. Looks like the "tree %s: %s" part is in the translated
> string. So a translation _could_ change it, though I'd expect it to only
> change the words and not the syntax. Maybe an RTL language would. I
> dunno.

Ah, right.  I can use $n markers in the format string to reorder
parameters, so we don't want scripts to rely on their order.  In
principle one can imagine GETTEXT_POISON printing a random permutation
of its arguments but this kind of nondeterminism in tests would be
harder to debug than the current state where the args aren't passed
through at all.

And after all, the main point of GETTEXT_POISON is to allow us to test
scripted commands to make sure we are not translating any output that
scripts would want to use.  For that purpose, the current poisoning
does what we need.  (In other words, we don't encourage non-test
scripts to rely on these lines at all, even to grep for
gitmodulesSymlink.)

Thanks,
Jonathan