From: Ævar Arnfjörð Bjarmason Date: Fri, 02 Jul 2021 13:29:49 GMT Subject: Re: [PATCH 03/15] [GSOC] ref-filter: --format=%(raw) re-support --perl Message-ID: <87fswwalmv.fsf@evledraar.gmail.com> In-Reply-To: <7d2314b43f21a470667971f1fdcb382f43bf51ed.1625155693.git.gitgitgadget@gmail.com> On Thu, Jul 01 2021, ZheNing Hu via GitGitGadget wrote: > From: ZheNing Hu > > Because the perl language can handle binary data correctly, > add the function perl_quote_buf_with_len(), which can specify > the length of the data and prevent the data from being truncated > at '\0' to help `--format="%(raw)"` re-support `--perl`. > > Helped-by: Ævar Arnfjörð Bjarmason > Signed-off-by: ZheNing Hu Thanks! > -test_expect_success '%(raw) with --perl must fail' ' > - test_must_fail git for-each-ref --format="%(raw)" --perl > +test_expect_success '%(raw) with --perl' ' > + git for-each-ref --format="\$name= %(raw); > +print \"\$name\"" refs/myblobs/blob1 --perl | perl > actual && > + cmp blob1 actual && > + git for-each-ref --format="\$name= %(raw); > +print \"\$name\"" refs/myblobs/blob3 --perl | perl > actual && > + cmp blob3 actual && > + git for-each-ref --format="\$name= %(raw); > +print \"\$name\"" refs/myblobs/blob8 --perl | perl > actual && > + cmp blob8 actual && > + git for-each-ref --format="\$name= %(raw); > +print \"\$name\"" refs/myblobs/first --perl | perl > actual && > + cmp one actual && > + git cat-file tree refs/mytrees/first > expected && > + git for-each-ref --format="\$name= %(raw); > +print \"\$name\"" refs/mytrees/first --perl | perl > actual && > + cmp expected actual > ' > > test_expect_success '%(raw) with --shell must fail' ' Nit: Formatting can be "| perl >actual", not "| perl > actual", like the usual style...