On 2020-04-20 12:59:37-0700, Junio C Hamano <gitster@xxxxxxxxx> wrote: > Đoàn Trần Công Danh <congdanhqx@xxxxxxxxx> writes: > > > diff --git a/t/t4254-am-corrupt.sh b/t/t4254-am-corrupt.sh > > index ddd35498db..98cda32d0a 100755 > > --- a/t/t4254-am-corrupt.sh > > +++ b/t/t4254-am-corrupt.sh > > @@ -3,6 +3,36 @@ > > test_description='git am with corrupt input' > > . ./test-lib.sh > > > > +write_nul_patch() { > > Style: SP on both sides of (), i.e. > > write_nul_patch () { > > But isn't this misnamed? You are interested in injecting '\0' byte Originally, this function was written to create a file named "nul.patch", but it's prohibited in Windows land. It's still misnamed, though. > in the e-mail headers and bodies, not necessarily part of the patch, > but "nul-patch" somehow hints readers that we are writing out a Null > Patch (something that does not do anything, perhaps?). > > sample_mbox_with_nul is the best alternative I can come up with > offhand, which is not great either, but at least it does not say > patch. I prefer having a verb, but make_sample_mbox_with_nul is too long. I'll take make_mbox_with_nul. Naming is hard. > > + cat <<-\EOF > > + --- > > + diff --git a/afile b/afile > > + new file mode 100644 > > + index 0000000000..e69de29bb2 > > + --$space > > + 2.26.1 > > + EOF > > Doesn't this want to interpolate $space in the output? I think you > want to say <<-EOF, without quoting. > > cd t && sh t4254-am-corrupt.sh -d && cat trash*.t4254-*/body.patch > > tells me that "--$space" is left in the output, not "-- ". I recalled it now. Originially, I wrote "-- " in that line, When I try git-am(1) the mail, I saw a warning about trailing space. I want to get rid of it but forget to change "-\EOF" Those last 2 lines isn't strictly required, I wanted to mimic a real patch created by git-format-patch, though. -- Danh