]>
Commit | Line | Data |
---|---|---|
9fdade06 JH |
1 | #!/bin/sh |
2 | # | |
3 | # Copyright (c) 2005 Junio C Hamano | |
4 | # | |
5 | ||
6 | test_description='Test mode change diffs. | |
7 | ||
8 | ' | |
9 | . ./test-lib.sh | |
10 | ||
2ece6ad2 | 11 | sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /' |
9fdade06 | 12 | |
ec57a821 ZJS |
13 | test_expect_success 'setup' ' |
14 | echo frotz >rezrov && | |
15 | git update-index --add rezrov && | |
e1d6b55d | 16 | tree=$(git write-tree) && |
ec57a821 ZJS |
17 | echo $tree |
18 | ' | |
9fdade06 | 19 | |
ec57a821 ZJS |
20 | test_expect_success 'chmod' ' |
21 | test_chmod +x rezrov && | |
22 | git diff-index $tree >current && | |
23 | sed -e "$sed_script" <current >check && | |
24 | echo ":100644 100755 X X M rezrov" >expected && | |
25 | test_cmp expected check | |
26 | ' | |
9fdade06 | 27 | |
4434e6ba ZJS |
28 | test_expect_success 'prepare binary file' ' |
29 | git commit -m rezrov && | |
9380aed2 | 30 | printf "\00\01\02\03\04\05\06" >binbin && |
4434e6ba ZJS |
31 | git add binbin && |
32 | git commit -m binbin | |
33 | ' | |
34 | ||
426fd36f JK |
35 | test_expect_success '--stat output after text chmod' ' |
36 | test_chmod -x rezrov && | |
37 | cat >expect <<-\EOF && | |
38 | rezrov | 0 | |
39 | 1 file changed, 0 insertions(+), 0 deletions(-) | |
40 | EOF | |
41 | git diff HEAD --stat >actual && | |
42 | test_i18ncmp expect actual | |
43 | ' | |
44 | ||
45 | test_expect_success '--shortstat output after text chmod' ' | |
46 | tail -n 1 <expect >expect.short && | |
47 | git diff HEAD --shortstat >actual && | |
48 | test_i18ncmp expect.short actual | |
49 | ' | |
50 | ||
51 | test_expect_success '--stat output after binary chmod' ' | |
52 | test_chmod +x binbin && | |
53 | cat >expect <<-EOF && | |
54 | binbin | Bin | |
55 | rezrov | 0 | |
56 | 2 files changed, 0 insertions(+), 0 deletions(-) | |
57 | EOF | |
58 | git diff HEAD --stat >actual && | |
59 | test_i18ncmp expect actual | |
60 | ' | |
61 | ||
62 | test_expect_success '--shortstat output after binary chmod' ' | |
63 | tail -n 1 <expect >expect.short && | |
64 | git diff HEAD --shortstat >actual && | |
65 | test_i18ncmp expect.short actual | |
66 | ' | |
4434e6ba | 67 | |
9fdade06 | 68 | test_done |