3 test_description='remote messages are colorized on the client'
7 test_expect_success 'setup' '
9 write_script .git/hooks/update <<-\EOF &&
11 echo ERROR: also highlighted
13 echo hinting: not highlighted
16 echo prefixerror: error
17 echo " " "error: leading space"
28 test_commit message2 file content2
32 test_expect_success 'keywords' '
33 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/keywords 2>output &&
34 test_decode_color <output >decoded &&
35 grep "<BOLD;RED>error<RESET>: error" decoded &&
36 grep "<YELLOW>hint<RESET>:" decoded &&
37 grep "<BOLD;GREEN>success<RESET>:" decoded &&
38 grep "<BOLD;YELLOW>warning<RESET>:" decoded
41 test_expect_success 'whole words at line start' '
42 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/whole-words 2>output &&
43 test_decode_color <output >decoded &&
44 grep "<YELLOW>hint<RESET>:" decoded &&
45 grep "hinting: not highlighted" decoded &&
46 grep "prefixerror: error" decoded
49 test_expect_success 'short line' '
50 git -C child -c color.remote=always push -f origin HEAD:short-line 2>output &&
51 test_decode_color <output >decoded &&
52 grep "remote: Err" decoded
55 test_expect_success 'case-insensitive' '
56 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/case-insensitive 2>output &&
58 test_decode_color <output >decoded &&
59 grep "<BOLD;RED>error<RESET>: error" decoded &&
60 grep "<BOLD;RED>ERROR<RESET>: also highlighted" decoded
63 test_expect_success 'leading space' '
64 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/leading-space 2>output && cat output &&
65 test_decode_color <output >decoded &&
66 grep " <BOLD;RED>error<RESET>: leading space" decoded
69 test_expect_success 'spaces only' '
70 git -C child -c color.remote=always push -f origin HEAD:only-space 2>output &&
71 test_decode_color <output >decoded &&
72 grep "remote: " decoded
75 test_expect_success 'no coloring for redirected output' '
76 git --git-dir child/.git push -f origin HEAD:refs/heads/redirected-output 2>output &&
77 test_decode_color <output >decoded &&
78 grep "error: error" decoded
81 test_expect_success 'push with customized color' '
82 git --git-dir child/.git -c color.remote=always -c color.remote.error=blue push -f origin HEAD:refs/heads/customized-color 2>output &&
83 test_decode_color <output >decoded &&
84 grep "<BLUE>error<RESET>:" decoded &&
85 grep "<BOLD;GREEN>success<RESET>:" decoded
89 test_expect_success 'error in customized color' '
90 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 &&
91 test_decode_color <output >decoded &&
92 grep "<BOLD;GREEN>success<RESET>:" decoded
95 test_expect_success 'fallback to color.ui' '
96 git --git-dir child/.git -c color.ui=always push -f origin HEAD:refs/heads/fallback-color-ui 2>output &&
97 test_decode_color <output >decoded &&
98 grep "<BOLD;RED>error<RESET>: error" decoded