Re: [PATCH v3] ls-files: update test style
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Jun 30, 2022, 15:54 UTC
- Message-ID
- <xmqq1qv6gn9q.fsf@gitster.g>
- In-Reply-To
- <2022062915111229306214@oschina.cn>
"lilinchao@oschina.cn" <lilinchao@oschina.cn> writes:
>>Mention end of here-document marker should by default be quoted, >>unless the body needs $variable_interpolation? > Sorry, I don't get it. I don't see many of ending "EOF" are quoted in our tests.
We encourage to quote the end marker when there is no interpolation in the here-document, so that ones that do not quote can stand out and grab attention by developers who are reading the tests, i.e.
cmd <<-EOF $variable interpolated EOF
The fact that EOF is not quoted serves as a signal to readers that they may want to inspect the here-doc text carefully with the variable interpolation in mind. If the EOF marker is quoted,
cmd <<-\EOF literal here text EOF
even if there are many lines in the here-document, the readers may not have to be so careful---what is used is what they see (modulo removing the leading indentation tabs).