Junio C Hamano | 9fdade0 | 2005-05-25 16:00:04 -0700 | [diff] [blame] | 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 | |
brian m. carlson | 2ece6ad | 2018-05-13 02:24:15 +0000 | [diff] [blame] | 11 | sed_script='s/\(:100644 100755\) \('"$OID_REGEX"'\) \2 /\1 X X /' |
Junio C Hamano | 9fdade0 | 2005-05-25 16:00:04 -0700 | [diff] [blame] | 12 | |
Zbigniew Jędrzejewski-Szmek | ec57a82 | 2012-05-01 19:10:12 +0200 | [diff] [blame] | 13 | test_expect_success 'setup' ' |
| 14 | echo frotz >rezrov && |
| 15 | git update-index --add rezrov && |
Elia Pinto | e1d6b55 | 2014-04-30 09:22:56 -0700 | [diff] [blame] | 16 | tree=$(git write-tree) && |
Zbigniew Jędrzejewski-Szmek | ec57a82 | 2012-05-01 19:10:12 +0200 | [diff] [blame] | 17 | echo $tree |
| 18 | ' |
Junio C Hamano | 9fdade0 | 2005-05-25 16:00:04 -0700 | [diff] [blame] | 19 | |
Zbigniew Jędrzejewski-Szmek | ec57a82 | 2012-05-01 19:10:12 +0200 | [diff] [blame] | 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 | ' |
Junio C Hamano | 9fdade0 | 2005-05-25 16:00:04 -0700 | [diff] [blame] | 27 | |
Zbigniew Jędrzejewski-Szmek | 4434e6b | 2012-05-01 19:10:13 +0200 | [diff] [blame] | 28 | test_expect_success 'prepare binary file' ' |
| 29 | git commit -m rezrov && |
Johannes Sixt | 9380aed | 2012-05-02 09:36:44 +0200 | [diff] [blame] | 30 | printf "\00\01\02\03\04\05\06" >binbin && |
Zbigniew Jędrzejewski-Szmek | 4434e6b | 2012-05-01 19:10:13 +0200 | [diff] [blame] | 31 | git add binbin && |
| 32 | git commit -m binbin |
| 33 | ' |
| 34 | |
Linus Torvalds | 74faaa1 | 2012-10-17 10:00:37 -0700 | [diff] [blame] | 35 | # test_expect_success '--stat output after text chmod' ' |
| 36 | # test_chmod -x rezrov && |
| 37 | # echo " 0 files changed" >expect && |
| 38 | # git diff HEAD --stat >actual && |
| 39 | # test_i18ncmp expect actual |
| 40 | # ' |
| 41 | # |
| 42 | # test_expect_success '--shortstat output after text chmod' ' |
| 43 | # git diff HEAD --shortstat >actual && |
| 44 | # test_i18ncmp expect actual |
| 45 | # ' |
| 46 | # |
| 47 | # test_expect_success '--stat output after binary chmod' ' |
| 48 | # test_chmod +x binbin && |
| 49 | # echo " 0 files changed" >expect && |
| 50 | # git diff HEAD --stat >actual && |
| 51 | # test_i18ncmp expect actual |
| 52 | # ' |
| 53 | # |
| 54 | # test_expect_success '--shortstat output after binary chmod' ' |
| 55 | # git diff HEAD --shortstat >actual && |
| 56 | # test_i18ncmp expect actual |
| 57 | # ' |
Zbigniew Jędrzejewski-Szmek | 4434e6b | 2012-05-01 19:10:13 +0200 | [diff] [blame] | 58 | |
Junio C Hamano | 9fdade0 | 2005-05-25 16:00:04 -0700 | [diff] [blame] | 59 | test_done |