Skip to content

Commit baa8d42

Browse files
committed
Merge branch 'sg/bash-prompt-lf-in-cwd-test'
* sg/bash-prompt-lf-in-cwd-test: bash prompt: test the prompt with newline in repository path
2 parents 7216b1f + a4889e6 commit baa8d42

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

t/t9903-bash-prompt.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,29 @@ test_expect_success 'prompt - unborn branch' '
6161
test_cmp expected "$actual"
6262
'
6363

64+
repo_with_newline='repo
65+
with
66+
newline'
67+
68+
if mkdir "$repo_with_newline" 2>/dev/null
69+
then
70+
test_set_prereq FUNNYNAMES
71+
else
72+
say 'Your filesystem does not allow newlines in filenames.'
73+
fi
74+
75+
test_expect_success FUNNYNAMES 'prompt - with newline in path' '
76+
printf " (master)" >expected &&
77+
git init "$repo_with_newline" &&
78+
test_when_finished "rm -rf \"$repo_with_newline\"" &&
79+
mkdir "$repo_with_newline"/subdir &&
80+
(
81+
cd "$repo_with_newline/subdir" &&
82+
__git_ps1 >"$actual"
83+
) &&
84+
test_cmp expected "$actual"
85+
'
86+
6487
test_expect_success 'prompt - detached head' '
6588
printf " ((%s...))" $(git log -1 --format="%h" --abbrev=13 b1^) >expected &&
6689
test_config core.abbrev 13 &&

0 commit comments

Comments
 (0)