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
'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
63 if test $engine = "perl"
71 if test $engine != "fixed"
75 test_expect_
$result GETTEXT_LOCALE
,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
76 cat >expect <<-\EOF &&
80 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$latin1_e\" >actual &&
81 test_cmp expect actual
84 test_expect_success GETTEXT_LOCALE
,$prereq "-c grep.patternType=$engine log --grep does not find non-reencoded values (latin1 + locale)" "
85 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$utf8_e\" >actual &&
86 test_must_be_empty actual
89 test_expect_
$result GETTEXT_LOCALE
,$prereq "-c grep.patternType=$engine log --grep does not die on invalid UTF-8 value (latin1 + locale + invalid needle)" "
90 LC_ALL=\"$is_IS_locale\" git -c grep.patternType=$engine log --encoding=ISO-8859-1 --format=%s --grep=\"$force_regex$invalid_e\" >actual &&
91 test_must_be_empty actual