Interested in helping open source friends on HP-UX?
[git/mjg.git] / t / t4210-log-i18n.sh
blob12b82f9aa2d31b40ab0ac914e2a324e725d795a9
1 #!/bin/sh
3 test_description='test log with i18n features'
4 . ./test-lib.sh
6 if ! test_have_prereq ICONV; then
7 skip_all='skipping i18n tests, iconv not available'
8 test_done
9 fi
11 # two forms of é
12 utf8_e=$(printf '\303\251')
13 latin1_e=$(printf '\351')
15 test_expect_success 'create commits in different encodings' '
16 test_tick &&
17 cat >msg <<-EOF &&
18 utf8
20 t${utf8_e}st
21 EOF
22 git add msg &&
23 git -c i18n.commitencoding=utf8 commit -F msg &&
24 cat >msg <<-EOF &&
25 latin1
27 t${latin1_e}st
28 EOF
29 git add msg &&
30 git -c i18n.commitencoding=ISO-8859-1 commit -F msg
33 test_expect_success 'log --grep searches in log output encoding (utf8)' '
34 cat >expect <<-\EOF &&
35 latin1
36 utf8
37 EOF
38 git log --encoding=utf8 --format=%s --grep=$utf8_e >actual &&
39 test_cmp expect actual
42 test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)' '
43 cat >expect <<-\EOF &&
44 latin1
45 utf8
46 EOF
47 git log --encoding=ISO-8859-1 --format=%s --grep=$latin1_e >actual &&
48 test_cmp expect actual
51 test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
52 >expect &&
53 git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
54 test_cmp expect actual
57 test_expect_success 'log --grep does not find non-reencoded values (latin1)' '
58 >expect &&
59 git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
60 test_cmp expect actual
63 test_done