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

Re: [PATCH] fixup! use perl instead of sed

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
May 9, 2017, 23:44 UTC
Message-ID
<CACBZZX7diKKuz0r2uWQsAmxDkWm_2Afi=zWSTRMYRwiobEGwpw@mail.gmail.com>
In-Reply-To
<xmqqd1bh1wqy.fsf@gitster.mtv.corp.google.com>
On Wed, May 10, 2017 at 12:38 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 31 quoted lines
> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:
>
>> On Tue, May 9, 2017 at 6:45 PM, Jonathan Tan <jonathantanmy@google.com> wrote:
>> ...
>>>         # Tweak the push output to make the push option outside the cert
>>>         # different, then replay it on a fresh dst, checking that ff is not
>>>         # deleted.
>>> -       sed -i "s/\\([^ ]\\)bar/\\1baz/" push &&
>>> +       perl -pe "s/([^ ])bar/\\1baz/" push >push.tweak &&
>>>         prepare_dst &&
>>>         git -C dst config receive.certnonceseed sekrit &&
>>>         git -C dst config receive.advertisepushoptions 1 &&
>>> -       git receive-pack dst <push >out &&
>>> +       git receive-pack dst <push.tweak >out &&
>>
>> The test should have a PERL prerequisite now, that's missing.
>
> For a single-liner like this, our stance has always been that t/
> scripts can assume _some_ version of Perl interpreter available for
> use, cf. t/README where it lists prerequisites and explains them:
>
>      - PERL
>
>        Git wasn't compiled with NO_PERL=YesPlease.
>
>        Even without the PERL prerequisite, tests can assume there is a
>        usable perl interpreter at $PERL_PATH, though it need not be
>        particularly modern.
>
> So unless "receive-pack" that is being tested here requires Perl at
> runtime, we do not want PERL prerequisite for this test.
Oops, sorry about that.
Show 8 quoted lines
>> Also using \1 will likely be deprecated in future versions of perl at
>> some point:
>>
>>     $ echo hifoo | perl -wpe "s/([^ ])bar/\\1baz/"
>>     \1 better written as $1 at -e line 1.
>>     hifoo
>
> Very good advice from a Perl expert; thanks.

No problem. Hopefully my noisy advice will at least lead to fixing a bug in perl if there is one :)

Previous: Junio C Hamano
Message 31 of 31 in “Clarify interaction between signed pushes and push options”
  1. 0/3 Clarify interaction between signed pushes and push optionsJonathan Tan, May 5, 2017
  2. 1/3 docs: correct receive.advertisePushOptions defaultJonathan Tan, May 5, 2017
  3. Brandon WilliamsMay 5, 2017
  4. Stefan BellerMay 5, 2017
  5. Jonathan NiederMay 5, 2017
  6. 2/3 receive-pack: verify push options in certJonathan Tan, May 5, 2017
  7. Stefan BellerMay 6, 2017
  8. Brandon WilliamsMay 6, 2017
  9. Jonathan NiederMay 6, 2017
  10. Jonathan NiederMay 6, 2017
  11. 3/3 protocol docs: explain receive-pack push optionsJonathan Tan, May 5, 2017
  12. Stefan BellerMay 6, 2017
  13. Jonathan NiederMay 6, 2017
  14. Jonathan TanMay 8, 2017
  15. Junio C HamanoMay 8, 2017
  16. 0/2 Clarify interaction between signed pushes and push optionsJonathan Tan, May 8, 2017
  17. 1/2 docs: correct receive.advertisePushOptions defaultJonathan Tan, May 8, 2017
  18. 2/2 receive-pack: verify push options in certJonathan Tan, May 8, 2017
  19. Junio C HamanoMay 9, 2017
  20. Junio C HamanoMay 9, 2017
  21. fixup! use perl instead of sedJonathan Tan, May 9, 2017
  22. Ævar Arnfjörð BjarmasonMay 9, 2017
  23. 0/2 Clarify interaction between signed pushes and push optionsJonathan Tan, May 9, 2017
  24. 1/2 docs: correct receive.advertisePushOptions defaultJonathan Tan, May 9, 2017
  25. 2/2 receive-pack: verify push options in certJonathan Tan, May 9, 2017
  26. fixup! don't use perl -i because it's not portableJonathan Tan, May 9, 2017
  27. Johannes SixtMay 9, 2017
  28. Jonathan TanMay 9, 2017
  29. Ævar Arnfjörð BjarmasonMay 9, 2017
  30. Junio C HamanoMay 9, 2017
  31. Ævar Arnfjörð BjarmasonMay 9, 2017

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.