3 # Copyright (c) 2005 Junio C Hamano
6 test_description
='Test mode change diffs.
10 TEST_PASSES_SANITIZE_LEAK
=true
13 sed_script
='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /'
15 test_expect_success
'setup' '
17 git update-index --add rezrov &&
18 tree=$(git write-tree) &&
22 test_expect_success
'chmod' '
23 test_chmod +x rezrov &&
24 git diff-index $tree >current &&
25 sed -e "$sed_script" <current >check &&
26 echo ":100644 100755 X X M rezrov" >expected &&
27 test_cmp expected check
30 test_expect_success
'prepare binary file' '
32 test_commit --printf two binbin "\00\01\02\03\04\05\06"
35 test_expect_success
'--stat output after text chmod' '
36 test_chmod -x rezrov &&
37 cat >expect <<-\EOF &&
39 1 file changed, 0 insertions(+), 0 deletions(-)
41 git diff HEAD --stat >actual &&
42 test_cmp expect actual
45 test_expect_success
'--shortstat output after text chmod' '
46 tail -n 1 <expect >expect.short &&
47 git diff HEAD --shortstat >actual &&
48 test_cmp expect.short actual
51 test_expect_success
'--stat output after binary chmod' '
52 test_chmod +x binbin &&
56 2 files changed, 0 insertions(+), 0 deletions(-)
58 git diff HEAD --stat >actual &&
59 test_cmp expect actual
62 test_expect_success
'--shortstat output after binary chmod' '
63 tail -n 1 <expect >expect.short &&
64 git diff HEAD --shortstat >actual &&
65 test_cmp expect.short actual