3 test_description='test log with i18n features'
7 utf8_e=$(printf '\303\251')
8 latin1_e=$(printf '\351')
11 invalid_e=$(printf '\303\50)') # ")" at end to close opening "("
13 test_expect_success 'create commits in different encodings' '
21 git -c i18n.commitencoding=utf8 commit -F msg &&
28 git -c i18n.commitencoding=ISO-8859-1 commit -F msg
31 test_expect_success 'log --grep searches in log output encoding (utf8)' '
32 cat >expect <<-\EOF &&
36 git log --encoding=utf8 --format=%s --grep=$utf8_e >actual &&
37 test_cmp expect actual
40 test_expect_success !MINGW 'log --grep searches in log output encoding (latin1)' '
41 cat >expect <<-\EOF &&
45 git log --encoding=ISO-8859-1 --format=%s --grep=$latin1_e >actual &&
46 test_cmp expect actual
49 test_expect_success !MINGW 'log --grep does not find non-reencoded values (utf8)' '
50 git log --encoding=utf8 --format=%s --grep=$latin1_e >actual &&
51 test_must_be_empty actual
54 test_expect_success !MINGW 'log --grep does not find non-reencoded values (latin1)' '
55 git log --encoding=ISO-8859-1 --format=%s --grep=$utf8_e >actual &&
56 test_must_be_empty actual
59 for engine in fixed basic extended perl
62 if test $engine = "perl"
69 if test $engine != "fixed"
73 test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
74 cat >expect <<-\EOF &&
78 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$latin1_e\" >actual &&
79 test_cmp expect actual
82 test_expect_success !MINGW,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
83 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$utf8_e\" >actual &&
84 test_must_be_empty actual
87 test_expect_success !MINGW,!REGEX_ILLSEQ,GETTEXT_LOCALE,$prereq "-c grep.patternType=$engine log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" "
88 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$invalid_e\" >actual &&
89 test_must_be_empty actual