t5540-http-push.sh: avoid non-portable grep -P
[4msysgit-hv.git] / t / t4201-shortlog.sh
blob405b97119175a1c0fa75a9db30c6b1ab076cc44e
1 #!/bin/sh
3 # Copyright (c) 2006 Johannes E. Schindelin
6 test_description='git shortlog
9 . ./test-lib.sh
11 echo 1 > a1
12 git add a1
13 tree=$(git write-tree)
14 commit=$( (echo "Test"; echo) | git commit-tree $tree )
15 git update-ref HEAD $commit
17 echo 2 > a1
18 git commit --quiet -m "This is a very, very long first line for the commit message to see if it is wrapped correctly" a1
20 # test if the wrapping is still valid when replacing all i's by treble clefs.
21 echo 3 > a1
22 git commit --quiet -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\360\235\204\236')" a1
24 # now fsck up the utf8
25 git config i18n.commitencoding non-utf-8
26 echo 4 > a1
27 git commit --quiet -m "$(echo "This is a very, very long first line for the commit message to see if it is wrapped correctly" | sed "s/i/1234/g" | tr 1234 '\370\235\204\236')" a1
29 echo 5 > a1
30 git commit --quiet -m "a 12 34 56 78" a1
32 git shortlog -w HEAD > out
34 cat > expect << EOF
35 A U Thor (5):
36 Test
37 This is a very, very long first line for the commit message to see if
38 it is wrapped correctly
39 Th𝄞s 𝄞s a very, very long f𝄞rst l𝄞ne for the comm𝄞t message to see 𝄞f
40 𝄞t 𝄞s wrapped correctly
41 Thø�„žs ø�„žs a very, very long fø�„žrst lø�„žne for the commø�„žt
42 message to see ø�„žf ø�„žt ø�„žs wrapped correctly
43 a 12 34
44 56 78
46 EOF
48 test_expect_success 'shortlog wrapping' 'test_cmp expect out'
50 git log HEAD > log
51 GIT_DIR=non-existing git shortlog -w < log > out
53 test_expect_success 'shortlog from non-git directory' 'test_cmp expect out'
55 test_done