Merge branch 'js/diff-notice-has-drive-prefix'
[gitweb.git] / t / t9903-bash-prompt.sh
index c3b89ae783d0b5511718be6d6b9d9978dd9131cd..81a5179e28bf529bc2f0a8bc197108fcb69fba72 100755 (executable)
@@ -63,18 +63,15 @@ test_expect_success 'prompt - unborn branch' '
        test_cmp expected "$actual"
 '
 
-repo_with_newline='repo
-with
-newline'
-
-if test_have_prereq !MINGW && mkdir "$repo_with_newline" 2>/dev/null
-then
-       test_set_prereq FUNNYNAMES
-else
+if test_have_prereq !FUNNYNAMES; then
        say 'Your filesystem does not allow newlines in filenames.'
 fi
 
 test_expect_success FUNNYNAMES 'prompt - with newline in path' '
+    repo_with_newline="repo
+with
+newline" &&
+       mkdir "$repo_with_newline" &&
        printf " (master)" >expected &&
        git init "$repo_with_newline" &&
        test_when_finished "rm -rf \"$repo_with_newline\"" &&
@@ -516,10 +513,9 @@ test_expect_success 'prompt - format string starting with dash' '
 
 test_expect_success 'prompt - pc mode' '
        printf "BEFORE: (\${__git_ps1_branch_name}):AFTER\\nmaster" >expected &&
-       printf "" >expected_output &&
        (
                __git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
-               test_cmp expected_output "$actual" &&
+               test_must_be_empty "$actual" &&
                printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual"
        ) &&
        test_cmp expected "$actual"
@@ -529,7 +525,7 @@ test_expect_success 'prompt - bash color pc mode - branch name' '
        printf "BEFORE: (${c_green}\${__git_ps1_branch_name}${c_clear}):AFTER\\nmaster" >expected &&
        (
                GIT_PS1_SHOWCOLORHINTS=y &&
-               __git_ps1 "BEFORE:" ":AFTER" >"$actual"
+               __git_ps1 "BEFORE:" ":AFTER" >"$actual" &&
                printf "%s\\n%s" "$PS1" "${__git_ps1_branch_name}" >"$actual"
        ) &&
        test_cmp expected "$actual"
@@ -715,13 +711,12 @@ test_expect_success 'prompt - hide if pwd ignored - env var set, config disabled
 '
 
 test_expect_success 'prompt - hide if pwd ignored - env var set, config unset' '
-       printf "" >expected &&
        (
                cd ignored_dir &&
                GIT_PS1_HIDE_IF_PWD_IGNORED=y &&
                __git_ps1 >"$actual"
        ) &&
-       test_cmp expected "$actual"
+       test_must_be_empty "$actual"
 '
 
 test_expect_success 'prompt - hide if pwd ignored - env var set, config unset, pc mode' '