| test_description='diff --relative tests' |
| test_expect_success 'setup' ' |
| git commit --allow-empty -m empty && |
| echo other content >subdir/file2 && |
| diff --git a/$expect b/$expect |
| test_expect_success "-p $*" " |
| git -C '$dir' diff -p $* HEAD^ >actual && |
| test_expect_success "--numstat $*" " |
| echo '1 0 $expect' >expected && |
| git -C '$dir' diff --numstat $* HEAD^ >actual && |
| 1 file changed, 1 insertion(+) |
| test_expect_success "--stat $*" " |
| git -C '$dir' diff --stat $* HEAD^ >actual && |
| test_i18ncmp expected actual |
| :000000 100644 0000000000000000000000000000000000000000 25c05ef3639d2d270e7fe765a67668f098092bc5 A $expect |
| test_expect_success "--raw $*" " |
| git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual && |
| for type in diff numstat stat raw |
| check_$type . file2 --relative=subdir/ |
| check_$type . file2 --relative=subdir |
| check_$type subdir file2 --relative |
| check_$type . dir/file2 --relative=sub |