]> git.ipfire.org Git - thirdparty/git.git/blame - t/t4210-log-i18n.sh
Merge branch 'rs/test-remove-useless-debugging-cat'
[thirdparty/git.git] / t / t4210-log-i18n.sh
CommitLineData
04deccda
JK
1#!/bin/sh
2
3test_description='test log with i18n features'
4. ./test-lib.sh
5
6# two forms of é
7utf8_e=$(printf '\303\251')
8latin1_e=$(printf '\351')
9
10test_expect_success 'create commits in different encodings' '
11 test_tick &&
12 cat >msg <<-EOF &&
13 utf8
14
15 t${utf8_e}st
16 EOF
17 git add msg &&
18 git -c i18n.commitencoding=utf8 commit -F msg &&
19 cat >msg <<-EOF &&
20 latin1
21
22 t${latin1_e}st
23 EOF
24 git add msg &&
25 git -c i18n.commitencoding=ISO-8859-1 commit -F msg
26'
27
28test_expect_success 'log --grep searches in log output encoding (utf8)' '
29 cat >expect <<-\EOF &&
30 latin1
31 utf8
32 EOF
33 git log --encoding=utf8 --format=%s --grep=$utf8_e >actual &&
34 test_cmp expect actual
35'
36
f57a8715 37test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)' '
04deccda
JK
38 cat >expect <<-\EOF &&
39 latin1
40 utf8
41 EOF
42 git log --encoding=ISO-8859-1 --format=%s --grep=$latin1_e >actual &&
43 test_cmp expect actual
44'
45
f57a8715 46test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
04deccda 47 git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
d3c6751b 48 test_must_be_empty actual
04deccda
JK
49'
50
51test_expect_success 'log --grep does not find non-reencoded values (latin1)' '
04deccda 52 git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
d3c6751b 53 test_must_be_empty actual
04deccda
JK
54'
55
56test_done