3 test_description='diff --relative tests'
6 test_expect_success 'setup' '
7 git commit --allow-empty -m empty &&
10 echo other content >subdir/file2 &&
11 blob=$(git hash-object subdir/file2) &&
21 short_blob=$(git rev-parse --short $blob)
23 diff --git a/$expect b/$expect
25 index 0000000..$short_blob
31 test_expect_success "-p $*" "
32 git -C '$dir' diff -p $* HEAD^ >actual &&
33 test_cmp expected actual
45 test_expect_success "--numstat $*" "
46 echo '1 0 $expect' >expected &&
47 git -C '$dir' diff --numstat $* HEAD^ >actual &&
48 test_cmp expected actual
59 1 file changed, 1 insertion(+)
61 test_expect_success "--stat $*" "
62 git -C '$dir' diff --stat $* HEAD^ >actual &&
63 test_i18ncmp expected actual
73 :000000 100644 0000000000000000000000000000000000000000 $blob A $expect
75 test_expect_success "--raw $*" "
76 git -C '$dir' diff --no-abbrev --raw $* HEAD^ >actual &&
77 test_cmp expected actual
81 for type in diff numstat stat raw
83 check_$type . file2 --relative=subdir/
84 check_$type . file2 --relative=subdir
85 check_$type subdir file2 --relative
86 check_$type . dir/file2 --relative=sub