public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Dragan Simic <dsimic@manjaro•org>
Cc: git@vger•kernel.org,  rsbecker@nexbridge•com,
	 github@seichter•de, sunshine@sunshineco•com
Subject: Re: [PATCH v3 3/4] t1300: add more tests for whitespace and inline comments
Date: Tue, 19 Mar 2024 23:42:03 -0700	[thread overview]
Message-ID: <xmqqzfutjtfo.fsf@gitster.g> (raw)
In-Reply-To: <92ddcd1f668906348e20a682cd737d90bb38ddc6.1710800549.git.dsimic@manjaro.org> (Dragan Simic's message of "Mon, 18 Mar 2024 23:24:21 +0100")

Dragan Simic <dsimic@manjaro•org> writes:

> +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.

  reply	other threads:[~2024-03-20  6:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-18 22:24 [PATCH v3 0/4] Fix a bug in configuration parsing, and improve tests and documentation Dragan Simic
2024-03-18 22:24 ` [PATCH v3 1/4] config: minor addition of whitespace Dragan Simic
2024-03-20  6:32   ` Junio C Hamano
2024-03-20  6:36     ` Dragan Simic
2024-03-18 22:24 ` [PATCH v3 2/4] config: really keep value-internal whitespace verbatim Dragan Simic
2024-03-18 22:24 ` [PATCH v3 3/4] t1300: add more tests for whitespace and inline comments Dragan Simic
2024-03-20  6:42   ` Junio C Hamano [this message]
2024-03-20  6:46     ` Dragan Simic
2024-03-20  6:59       ` Dragan Simic
2024-03-20 14:28         ` Junio C Hamano
2024-03-20 16:11           ` Dragan Simic
2024-03-18 22:24 ` [PATCH v3 4/4] config.txt: describe handling of whitespace further Dragan Simic
2024-03-20  7:12   ` Junio C Hamano
2024-03-20  7:23     ` Dragan Simic
2024-03-20 14:42       ` Junio C Hamano
2024-03-20 16:17         ` Dragan Simic

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=xmqqzfutjtfo.fsf@gitster.g \
    --to=gitster@pobox$(echo .)com \
    --cc=dsimic@manjaro$(echo .)org \
    --cc=git@vger$(echo .)kernel.org \
    --cc=github@seichter$(echo .)de \
    --cc=rsbecker@nexbridge$(echo .)com \
    --cc=sunshine@sunshineco$(echo .)com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox