Thread (3 messages) read the whole thread 3 messages, 2 authors, 2024-03-20

Re: [PATCH v3 3/4] t1300: add more tests for whitespace and inline comments

From: Dragan Simic <hidden>
Date: 2024-03-20 06:46:44

On 2024-03-20 07:42, Junio C Hamano wrote:
Dragan Simic [off-list ref] writes:
quoted
+test_expect_success 'setup whitespace config' '
+	tr "X" "\011" >.git/config <<-\EOF
+	[section]
+		Xsolid = rock
+		Xsparse = big XX blue
+		XsparseAndTail = big XX blue
+		XsparseAndTailQuoted = "big XX blue "
+		XsparseAndBiggerTail = big XX blue X X
+		XsparseAndBiggerTailQuoted = "big XX blue X X"
+		XsparseAndBiggerTailQuotedPlus = "big XX blue X X"X
+		XheadAndTail = Xbig blue
+		XheadAndTailQuoted = "Xbig blue "
+		XheadAndTailQuotedPlus = "Xbig blue "
+		Xannotated = big blueX# to be discarded
+		XannotatedQuoted = "big blue"X# to be discarded
+	EOF
+'
If you want to write tests where leading and trailing whitespace
matter in them, making these invisible characters visible is a good
way to convey your intention to your readers.

	sed -e "s/Q/	/g" \
	    -e "s/^|//" \
	    -e "s/[$]$//" <<-\EOF
	|[section]
	|	solid = rock  $
	|	sparse = tab and space Q $
	EOF

This is still true even if we assume there is no patch corruption
while the e-mail is in transit.  It is safe to assume that the
receiving end of your patches uses "git am --whitespace=fix" and a
common way to protect against it is to use the opposite of "cat -e"
as a convention, additional to the "'|' is the left edge of paper"
and "Q stands for HT" conventions.
Agreed, will make it so in the v4.  I already had some thoughts
about protecting the trailing whitespace, and making obvious it
wasn't included by mistake.

Though, I'll have to use 'X' istead of 'Q' for HTs, because the
option names already contain 'Q' characters.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help