3 test_description
='Test "stg repair" with non-utf-8 commit data encodings'
7 test_expect_success
'Create git commit with ISO8859-1 message and author' '
10 git commit -a -m foo &&
11 echo "0" >> foo.txt &&
12 test_config i18n.commitencoding ISO8859-1 &&
14 . "$TEST_DIRECTORY"/t1305/author-8859-1.txt &&
15 git commit -a -F "$TEST_DIRECTORY"/t1305/message-8859-1.txt
17 git cat-file -p HEAD | grep -e "^encoding ISO8859-1"
20 test_expect_success
'Initialize the StGit repository' '
24 test_expect_success
'No-op repair with non-utf-8 encoded message in history' '
28 test_expect_success
'Uncommit patch' '
32 test_expect_success
'Check patch name is utf-8' '
33 test "$(stg series --applied --noprefix)" = "äëñïö"
36 test_expect_success
'Check show is utf-8' '
37 stg show | grep -e "Author: Áéí óú <author@example.com>"
40 test_expect_success
'Check underlying commit is ISO8859-1' '
41 git cat-file -p HEAD > "$HOME"/commit-data.txt &&
42 cat "$HOME"/commit-data.txt |
43 grep -e "^encoding ISO8859-1" &&
44 cat "$HOME"/commit-data.txt |
46 cut -d" " -f 2-4 > "$HOME"/auth-8859-1.txt &&
47 cat "$HOME"/auth-8859-1.txt |
48 iconv -f ISO8859-1 -t UTF-8 > "$HOME"/auth-utf8.txt &&
49 test "Áéí óú <author@example.com>" = "$(cat "$HOME"/auth-utf8.txt)"
52 test_expect_success
'Encoding after edit' '
53 stg edit --sign 2> "$HOME"/warnings.txt &&
54 test_must_be_empty "$HOME"/warnings.txt &&
55 git cat-file -p HEAD | grep -e "ÄËÑÏÖ" &&
56 git cat-file -p HEAD | grep -e "Ábçdèfg" &&
57 git cat-file -p HEAD | grep -e "Signed-off-by: C Ó Mitter <committer@example.com>"