3 # Copyright (c) 2006 Johannes E. Schindelin
6 test_description='git shortlog
11 test_expect_success 'setup' '
14 tree=$(git write-tree) &&
15 commit=$(printf "%s\n" "Test" "" | git commit-tree "$tree") &&
16 git update-ref HEAD "$commit" &&
19 git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1 &&
21 # test if the wrapping is still valid
22 # when replacing all is by treble clefs.
24 git commit --quiet -m "$(
25 echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" |
27 tr 1234 "\360\235\204\236")" a1 &&
29 # now fsck up the utf8
30 git config i18n.commitencoding non-utf-8 &&
32 git commit --quiet -m "$(
33 echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" |
35 tr 1234 "\370\235\204\236")" a1 &&
38 git commit --quiet -m "a 12 34 56 78" a1
41 test_expect_success 'shortlog wrapping' '
45 This is a very, very long first line for the commit message to see if
46 it is wrapped correctly
47 Th𝄞s 𝄞s a very, very long f𝄞rst l𝄞ne for the comm𝄞t message to see 𝄞f
48 𝄞t 𝄞s wrapped correctly
49 Thø
\9d\84\9es ø
\9d\84\9es a very, very long fø
\9d\84\9erst lø
\9d\84\9ene for the commø
\9d\84\9et
50 message to see ø
\9d\84\9ef ø
\9d\84\9et ø
\9d\84\9es wrapped correctly
55 git shortlog -w HEAD >out &&
59 test_expect_success 'shortlog from non-git directory' '
61 GIT_DIR=non-existing git shortlog -w <log >out &&
65 iconvfromutf8toiso88591() {
66 printf "%s" "$*" | iconv -f UTF-8 -t ISO8859-1
69 DSCHO="Jöhännës \"Dschö\" Schindëlin"
70 DSCHOE="$DSCHO <Johannes.Schindelin@gmx.de>"
71 MSG1="set a1 to 2 and some non-ASCII chars: Äßø"
72 MSG2="set a1 to 3 and some non-ASCII chars: áæï"
80 test_expect_success 'shortlog encoding' '
81 git reset --hard "$commit" &&
82 git config --unset i18n.commitencoding &&
84 git commit --quiet -m "$MSG1" --author="$DSCHOE" a1 &&
85 git config i18n.commitencoding "ISO8859-1" &&
87 git commit --quiet -m "$(iconvfromutf8toiso88591 "$MSG2")" \
88 --author="$(iconvfromutf8toiso88591 "$DSCHOE")" a1 &&
89 git config --unset i18n.commitencoding &&
90 git shortlog HEAD~2.. > out &&