Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON

3 messages, 3 authors, 2016-06-16 · open the first message on its own page

Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON

From: Junio C Hamano <hidden>
Date: 2016-06-16 02:19:32

Eric Sunshine [off-list ref] writes:
[cc:+junio]

Indeed, the sed seems superfluous. The output of the test command is:

    git: 'lfg' is not a git command. See 'git --help'.

    Did you mean this?
        lgf

And, the grep'd string, "lgf" only appears once, so grep alone should
be sufficient to verify expected behavior.
We want to see the string appear after "Did you mean this?" and we
do not want to be fooled by a future change in the early part of the
message, which may contain a substring l-g-f that does not have
anything to do with the alias we are looking for.

And the way you express "I do not care anything above this line" is
to say "sed -e '1,/^that line/d'".

Of course, if you use this with POISON, you'd need to consider that
"Did you mean this" would not be a good marker to identify where the
introductory text we want to ignore ends.  You'd need to find a
different mechanism to exclude the introductory text if you want to
retain the future-proofing the existing "sed -e" gave us.

Perhaps discarding up to the first blank line (i.e. assuming that we
would not remove that blank, and also assuming that we will not
rephrase "Did you mean this?") may be a good alternative.

Or assuming that the explanatory text would not begin its lines with
a tab, i.e.

	grep '^	lgf$' actual

(the space between '^' and 'l' above is a TAB) without using
test_i18ngrep?

I think I like that the best among what I can think of offhand.

Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON

From: Eric Sunshine <hidden>
Date: 2016-06-16 02:19:32

On Fri, May 20, 2016 at 12:39 PM, Junio C Hamano [off-list ref] wrote:
Eric Sunshine [off-list ref] writes:
quoted
Indeed, the sed seems superfluous. The output of the test command is:

    git: 'lfg' is not a git command. See 'git --help'.

    Did you mean this?
        lgf

And, the grep'd string, "lgf" only appears once, so grep alone should
be sufficient to verify expected behavior.
Perhaps discarding up to the first blank line (i.e. assuming that we
would not remove that blank, and also assuming that we will not
rephrase "Did you mean this?") may be a good alternative.

Or assuming that the explanatory text would not begin its lines with
a tab, i.e.

        grep '^ lgf$' actual

(the space between '^' and 'l' above is a TAB) without using
test_i18ngrep?

I think I like that the best among what I can think of offhand.
Yep, I also considered both of these approaches and favored the latter, as well.

Re: [PATCH 19/21] t9003: become resilient to GETTEXT_POISON

From: Vasco Almeida <hidden>
Date: 2016-06-16 02:19:32

Às 16:39 de 20-05-2016, Junio C Hamano escreveu:
We want to see the string appear after "Did you mean this?" and we
do not want to be fooled by a future change in the early part of the
message, which may contain a substring l-g-f that does not have
anything to do with the alias we are looking for.

And the way you express "I do not care anything above this line" is
to say "sed -e '1,/^that line/d'".

Of course, if you use this with POISON, you'd need to consider that
"Did you mean this" would not be a good marker to identify where the
introductory text we want to ignore ends.  You'd need to find a
different mechanism to exclude the introductory text if you want to
retain the future-proofing the existing "sed -e" gave us.

Perhaps discarding up to the first blank line (i.e. assuming that we
would not remove that blank, and also assuming that we will not
rephrase "Did you mean this?") may be a good alternative.

Or assuming that the explanatory text would not begin its lines with
a tab, i.e.

	grep '^	lgf$' actual

(the space between '^' and 'l' above is a TAB) without using
test_i18ngrep?

I think I like that the best among what I can think of offhand.
Alternatively, we could leave sed alone as it were before this patch and
use test_i18ngrep instead of grep to fake success under GETTEXT_POISON.
I think I prefer this way. What do you think?
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help