Git development
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: Pasha Bolokhov <pasha.bolokhov@gmail.com>,
	git@vger.kernel.org, pclouds@gmail.com
Subject: Re: [PATCH alt-v3] Improve function dir.c:trim_trailing_spaces()
Date: Fri, 13 Jun 2014 19:25:38 -0400	[thread overview]
Message-ID: <20140613232537.GB23078@sigill> (raw)
In-Reply-To: <xmqqoaxw1ru4.fsf@gitster.dls.corp.google.com>

On Fri, Jun 13, 2014 at 01:23:47PM -0700, Junio C Hamano wrote:

> This passes with your shell set to dash but fails with bash.
> 
> Let's fix it up like so.

Thanks, I should have been more suspicious of the combination of backslashes
and echo during review. :)

> diff --git a/t/t0008-ignores.sh b/t/t0008-ignores.sh
> index 5ef5ad3..39e55a1 100755
> --- a/t/t0008-ignores.sh
> +++ b/t/t0008-ignores.sh
> @@ -816,12 +816,14 @@ test_expect_success NOT_MINGW,NOT_CYGWIN 'correct handling of backslashes' '
>  	>"whitespace/trailing 5 \\ \\ " &&
>  	>"whitespace/trailing 6 \\a\\" &&
>  	>whitespace/untracked &&
> -	echo "whitespace/trailing 1 \\    " >ignore  &&
> -	echo "whitespace/trailing 2 \\\\\\\\\\\\\\\\" >>ignore &&
> -	echo "whitespace/trailing 3 \\\\\\\\\\\\\\\\ " >>ignore &&
> -	echo "whitespace/trailing 4   \\\\\\\\\\\\    " >>ignore &&
> -	echo "whitespace/trailing 5 \\\\\\\\ \\\\\\\\\\\\   " >>ignore &&
> -	echo "whitespace/trailing 6 \\\\\\\\a\\\\\\\\" >>ignore &&
> +	sed -e "s/Z$//" >ignore <<-\EOF &&
> +	whitespace/trailing 1 \    Z
> +	whitespace/trailing 2 \\\\Z
> +	whitespace/trailing 3 \\\\ Z
> +	whitespace/trailing 4   \\\    Z
> +	whitespace/trailing 5 \\ \\\   Z
> +	whitespace/trailing 6 \\a\\Z
> +	EOF

The end result is much more readable, too, IMHO.

-Peff

  reply	other threads:[~2014-06-13 23:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-02 22:36 [PATCH alt-v3] Improve function dir.c:trim_trailing_spaces() Pasha Bolokhov
2014-06-02 22:54 ` Junio C Hamano
2014-06-13 20:23 ` Junio C Hamano
2014-06-13 23:25   ` Jeff King [this message]
2014-06-14  2:45     ` Pasha Bolokhov

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=20140613232537.GB23078@sigill \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=pasha.bolokhov@gmail.com \
    --cc=pclouds@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
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