Skip to contentSkip to conversation

t4038-diff-combined: quote paths with whitespace

PATCH In review Todd Zullinger 4 participants 4 messages Mar 17, 2019 – Mar 18, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 t4038-diff-combined: quote paths with whitespace

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.

---
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(-)
t/t4038-diff-combined.sh +4 -4
index 07b49f6d6d..d4afe12554 100755
@@ -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
Signature · 1 line
Todd
#1 lore raw
Quoted 2 lines · Todd Zullinger

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

s/files/filenames/

Quoted 9 lines

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

---

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.

#2 lore raw
In reply to Todd Zullinger
Quoted 5 lines · Todd Zullinger

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.

#3 lore raw
In reply to Todd Zullinger
Quoted 36 lines · Todd Zullinger

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.

---
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(-)
t/t4038-diff-combined.sh +3 -3
index 07b49f6d6d..d4afe12554 100755
@@ -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 &&

t/t4038-diff-combined.sh test_expect_success FUNNYNAMES 'setup for --combined-all-paths with funny names'

Quoted 10 lines
t/t4038-diff-combined.sh +1 -2
        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.