# [PATCH] t4038-diff-combined: quote paths with whitespace

4 messages from 2019-03-17 to 2019-03-18. Participants: Todd Zullinger, Eric Sunshine, Junio C Hamano, Elijah Newren.
Thread: https://gitlist.dev/t/50768

## Todd Zullinger, 2019-03-17 23:02

Subject: [PATCH] t4038-diff-combined: quote paths with whitespace
Message-ID: <20190317230239.10131-1-tmz@pobox.com>
URL: https://gitlist.dev/e/20190317230239.10131-1-tmz%40pobox.com

```
d76ce4f734 ("log,diff-tree: add --combined-all-paths option",
2019-02-07) added tests for files containing tabs.

When the tests are run with bash, the lack of quoting during the file
setup causes 'ambiguous redirect' errors.

Signed-off-by: Todd Zullinger <tmz@pobox.com>
---
Hi,

I noticed these failures while running in a repo where I happened
to have TEST_SHELL_PATH=/bin/bash set.  I wonder if we should
have a test matrix which uses bash to catch these sort of things?

 t/t4038-diff-combined.sh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
index 07b49f6d6d..d4afe12554 100755
--- a/t/t4038-diff-combined.sh
+++ b/t/t4038-diff-combined.sh
@@ -480,18 +480,18 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names'
 	git branch side1d &&
 	git branch side2d &&
 	git checkout side1d &&
-	test_seq 1 10 >$(printf "file\twith\ttabs") &&
+	test_seq 1 10 >"$(printf "file\twith\ttabs")" &&
 	git add file* &&
 	git commit -m with &&
 	git checkout side2d &&
-	test_seq 1 9 >$(printf "i\tam\ttabbed") &&
-	echo ten >>$(printf "i\tam\ttabbed") &&
+	test_seq 1 9 >"$(printf "i\tam\ttabbed")" &&
+	echo ten >>"$(printf "i\tam\ttabbed")" &&
 	git add *tabbed &&
 	git commit -m iam &&
 	git checkout -b funny-names-mergery side1d &&
 	git merge --no-commit side2d &&
 	git rm *tabs &&
-	echo eleven >>$(printf "i\tam\ttabbed") &&
+	echo eleven >>"$(printf "i\tam\ttabbed")" &&
 	git mv "$(printf "i\tam\ttabbed")" "$(printf "fickle\tnaming")" &&
 	git add fickle* &&
 	git commit
-- 
Todd

```

## Eric Sunshine, 2019-03-17 23:11

Subject: Re: [PATCH] t4038-diff-combined: quote paths with whitespace
Message-ID: <CAPig+cR5uqE+9smKcvZr0oaw2XyqWsYORwAga4WLUX5N+hU4bA@mail.gmail.com>
URL: https://gitlist.dev/e/CAPig%2BcR5uqE%2B9smKcvZr0oaw2XyqWsYORwAga4WLUX5N%2BhU4bA%40mail.gmail.com
In-Reply-To: <20190317230239.10131-1-tmz@pobox.com>

```
On Sun, Mar 17, 2019 at 7:02 PM Todd Zullinger <tmz@pobox.com> wrote:
> d76ce4f734 ("log,diff-tree: add --combined-all-paths option",
> 2019-02-07) added tests for files containing tabs.

s/files/filenames/

> When the tests are run with bash, the lack of quoting during the file
> setup causes 'ambiguous redirect' errors.
>
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
>
> I noticed these failures while running in a repo where I happened
> to have TEST_SHELL_PATH=/bin/bash set.  I wonder if we should
> have a test matrix which uses bash to catch these sort of things?

Maybe just extending "make test-lint" to catch these would suffice.

```

## Junio C Hamano, 2019-03-18 06:51

Subject: Re: [PATCH] t4038-diff-combined: quote paths with whitespace
Message-ID: <xmqqwokw1xpw.fsf@gitster-ct.c.googlers.com>
URL: https://gitlist.dev/e/xmqqwokw1xpw.fsf%40gitster-ct.c.googlers.com
In-Reply-To: <20190317230239.10131-1-tmz@pobox.com>

```
Todd Zullinger <tmz@pobox.com> writes:

> d76ce4f734 ("log,diff-tree: add --combined-all-paths option",
> 2019-02-07) added tests for files containing tabs.
>
> When the tests are run with bash, the lack of quoting during the file
> setup causes 'ambiguous redirect' errors.

Thanks.

```

## Elijah Newren, 2019-03-18 15:38

Subject: Re: [PATCH] t4038-diff-combined: quote paths with whitespace
Message-ID: <CABPp-BGY_SSJ5GsCz09jDgBzX9Xmbpd95bYcfK4FbpHfgNQgRQ@mail.gmail.com>
URL: https://gitlist.dev/e/CABPp-BGY_SSJ5GsCz09jDgBzX9Xmbpd95bYcfK4FbpHfgNQgRQ%40mail.gmail.com
In-Reply-To: <20190317230239.10131-1-tmz@pobox.com>

```
On Sun, Mar 17, 2019 at 4:02 PM Todd Zullinger <tmz@pobox.com> wrote:
>
> d76ce4f734 ("log,diff-tree: add --combined-all-paths option",
> 2019-02-07) added tests for files containing tabs.
>
> When the tests are run with bash, the lack of quoting during the file
> setup causes 'ambiguous redirect' errors.
>
> Signed-off-by: Todd Zullinger <tmz@pobox.com>
> ---
> Hi,
>
> I noticed these failures while running in a repo where I happened
> to have TEST_SHELL_PATH=/bin/bash set.  I wonder if we should
> have a test matrix which uses bash to catch these sort of things?
>
>  t/t4038-diff-combined.sh | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/t/t4038-diff-combined.sh b/t/t4038-diff-combined.sh
> index 07b49f6d6d..d4afe12554 100755
> --- a/t/t4038-diff-combined.sh
> +++ b/t/t4038-diff-combined.sh
> @@ -480,18 +480,18 @@ test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names'
>         git branch side1d &&
>         git branch side2d &&
>         git checkout side1d &&
> -       test_seq 1 10 >$(printf "file\twith\ttabs") &&
> +       test_seq 1 10 >"$(printf "file\twith\ttabs")" &&
>         git add file* &&
>         git commit -m with &&
>         git checkout side2d &&
> -       test_seq 1 9 >$(printf "i\tam\ttabbed") &&
> -       echo ten >>$(printf "i\tam\ttabbed") &&
> +       test_seq 1 9 >"$(printf "i\tam\ttabbed")" &&
> +       echo ten >>"$(printf "i\tam\ttabbed")" &&
>         git add *tabbed &&
>         git commit -m iam &&
>         git checkout -b funny-names-mergery side1d &&
>         git merge --no-commit side2d &&
>         git rm *tabs &&
> -       echo eleven >>$(printf "i\tam\ttabbed") &&
> +       echo eleven >>"$(printf "i\tam\ttabbed")" &&
>         git mv "$(printf "i\tam\ttabbed")" "$(printf "fickle\tnaming")" &&
>         git add fickle* &&
>         git commit
> --

Whoops, how embarrassing.  Thanks for fixing this.

```
