On Tue, May 9, 2017 at 6:45 PM, Jonathan Tan <[email protected]> wrote:
> Signed-off-by: Jonathan Tan <[email protected]>
> ---
>
> Thanks - I didn't realize the existence of the test lint. Here's a
> fixup. Let me know if you prefer a full reroll.
>
> I had to use perl because "push" is a binary file (the first line
> contains a NUL).
>
>
> t/t5534-push-signed.sh | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/t/t5534-push-signed.sh b/t/t5534-push-signed.sh
> index 0ef6f66b5..3ee58dafb 100755
> --- a/t/t5534-push-signed.sh
> +++ b/t/t5534-push-signed.sh
> @@ -152,11 +152,11 @@ test_expect_success GPG 'inconsistent push options in
> signed push not allowed' '
> # 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.
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
Finally, you can just use -i like you did with sed, no need for the tempfile:
$ echo hibar >push
$ perl -pi -e 's/([^ ])bar/$1baz/' push
$ cat push
hibaz
> git -C dst rev-parse ff &&
> grep "inconsistent push options" out
> '
> --
> 2.13.0.rc2.291.g57267f2277-goog
>