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"
26 test_commit message2 file content2
30 test_expect_success 'keywords' '
31 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/keywords 2>output &&
32 test_decode_color <output >decoded &&
33 grep "<BOLD;RED>error<RESET>: error" decoded &&
34 grep "<YELLOW>hint<RESET>:" decoded &&
35 grep "<BOLD;GREEN>success<RESET>:" decoded &&
36 grep "<BOLD;YELLOW>warning<RESET>:" decoded
39 test_expect_success 'whole words at line start' '
40 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/whole-words 2>output &&
41 test_decode_color <output >decoded &&
42 grep "<YELLOW>hint<RESET>:" decoded &&
43 grep "hinting: not highlighted" decoded &&
44 grep "prefixerror: error" decoded
47 test_expect_success 'case-insensitive' '
48 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/case-insensitive 2>output &&
50 test_decode_color <output >decoded &&
51 grep "<BOLD;RED>error<RESET>: error" decoded &&
52 grep "<BOLD;RED>ERROR<RESET>: also highlighted" decoded
55 test_expect_success 'leading space' '
56 git --git-dir child/.git -c color.remote=always push -f origin HEAD:refs/heads/leading-space 2>output && cat output &&
57 test_decode_color <output >decoded &&
58 grep " <BOLD;RED>error<RESET>: leading space" decoded
61 test_expect_success 'no coloring for redirected output' '
62 git --git-dir child/.git push -f origin HEAD:refs/heads/redirected-output 2>output &&
63 test_decode_color <output >decoded &&
64 grep "error: error" decoded
67 test_expect_success 'push with customized color' '
68 git --git-dir child/.git -c color.remote=always -c color.remote.error=blue push -f origin HEAD:refs/heads/customized-color 2>output &&
69 test_decode_color <output >decoded &&
70 grep "<BLUE>error<RESET>:" decoded &&
71 grep "<BOLD;GREEN>success<RESET>:" decoded
75 test_expect_success 'error in customized color' '
76 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 &&
77 test_decode_color <output >decoded &&
78 grep "<BOLD;GREEN>success<RESET>:" decoded
81 test_expect_success 'fallback to color.ui' '
82 git --git-dir child/.git -c color.ui=always push -f origin HEAD:refs/heads/fallback-color-ui 2>output &&
83 test_decode_color <output >decoded &&
84 grep "<BOLD;RED>error<RESET>: error" decoded