builtin/rebase: compute checkout metadata for rebases
[git/raj.git] / t / t5409-colorize-remote-messages.sh
blob5d8f401d8ece8cc76e8c46591ed4883337e57a5f
1 #!/bin/sh
3 test_description='remote messages are colorized on the client'
5 . ./test-lib.sh
7 test_expect_success 'setup' '
8 mkdir .git/hooks &&
9 write_script .git/hooks/update <<-\EOF &&
10 echo error: error
11 echo ERROR: also highlighted
12 echo hint: hint
13 echo hinting: not highlighted
14 echo success: success
15 echo warning: warning
16 echo prefixerror: error
17 echo " " "error: leading space"
18 echo " "
19 echo Err
20 echo SUCCESS
21 exit 0
22 EOF
23 echo 1 >file &&
24 git add file &&
25 git commit -m 1 &&
26 git clone . child &&
28 cd child &&
29 test_commit message2 file content2
33 test_expect_success 'keywords' '
34 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/keywords 2>output &&
35 test_decode_color <output >decoded &&
36 grep "<BOLD;RED>error<RESET>: error" decoded &&
37 grep "<YELLOW>hint<RESET>:" decoded &&
38 grep "<BOLD;GREEN>success<RESET>:" decoded &&
39 grep "<BOLD;GREEN>SUCCESS<RESET>" decoded &&
40 grep "<BOLD;YELLOW>warning<RESET>:" decoded
43 test_expect_success 'whole words at line start' '
44 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/whole-words 2>output &&
45 test_decode_color <output >decoded &&
46 grep "<YELLOW>hint<RESET>:" decoded &&
47 grep "hinting: not highlighted" decoded &&
48 grep "prefixerror: error" decoded
51 test_expect_success 'short line' '
52 git -C child -c color.remote=always push -f origin HEAD:short-line 2>output &&
53 test_decode_color <output >decoded &&
54 grep "remote: Err" decoded
57 test_expect_success 'case-insensitive' '
58 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/case-insensitive 2>output &&
59 test_decode_color <output >decoded &&
60 grep "<BOLD;RED>error<RESET>: error" decoded &&
61 grep "<BOLD;RED>ERROR<RESET>: also highlighted" decoded
64 test_expect_success 'leading space' '
65 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/leading-space 2>output &&
66 test_decode_color <output >decoded &&
67 grep " <BOLD;RED>error<RESET>: leading space" decoded
70 test_expect_success 'spaces only' '
71 git -C child -c color.remote=always push -f origin HEAD:only-space 2>output &&
72 test_decode_color <output >decoded &&
73 grep "remote: " decoded
76 test_expect_success 'no coloring for redirected output' '
77 git --git-dir child/.git push -f origin HEAD:refs/heads/redirected-output 2>output &&
78 test_decode_color <output >decoded &&
79 grep "error: error" decoded
82 test_expect_success 'push with customized color' '
83 git --git-dir child/.git -c color.remote=always -c color.remote.error=blue push -f origin HEAD:refs/heads/customized-color 2>output &&
84 test_decode_color <output >decoded &&
85 grep "<BLUE>error<RESET>:" decoded &&
86 grep "<BOLD;GREEN>success<RESET>:" decoded
90 test_expect_success 'error in customized color' '
91 git --git-dir child/.git -c color.remote=always -c color.remote.error=i-am-not-a-color push -f origin HEAD:refs/heads/error-customized-color 2>output &&
92 test_decode_color <output >decoded &&
93 grep "<BOLD;GREEN>success<RESET>:" decoded
96 test_expect_success 'fallback to color.ui' '
97 git --git-dir child/.git -c color.ui=always push -f origin HEAD:refs/heads/fallback-color-ui 2>output &&
98 test_decode_color <output >decoded &&
99 grep "<BOLD;RED>error<RESET>: error" decoded
102 test_done