3 test_description
='test direct comparison of blobs via git-diff'
5 TEST_PASSES_SANITIZE_LEAK
=true
9 # use full-index to make it easy to match the index line
10 git
diff --full-index "$@" >diff
14 grep "^index $1\\.\\.$2" diff
18 grep "^old mode $1" diff &&
19 grep "^new mode $2" diff
23 grep "^diff --git a/$1 b/$2" diff
26 test_expect_success
'create some blobs' '
32 # cover systems where modes are ignored
33 git update-index --chmod=+x two &&
37 sha1_one=$(git rev-parse HEAD:one) &&
38 sha1_two=$(git rev-parse HEAD:two)
41 test_expect_success
'diff by sha1' '
42 run_diff $sha1_one $sha1_two
44 test_expect_success
'index of sha1 diff' '
45 check_index $sha1_one $sha1_two
47 test_expect_success
'sha1 diff uses arguments as paths' '
48 check_paths $sha1_one $sha1_two
50 test_expect_success
'sha1 diff has no mode change' '
54 test_expect_success
'diff by tree:path (run)' '
55 run_diff HEAD:one HEAD:two
57 test_expect_success
'index of tree:path diff' '
58 check_index $sha1_one $sha1_two
60 test_expect_success
'tree:path diff uses filenames as paths' '
63 test_expect_success
'tree:path diff shows mode change' '
64 check_mode 100644 100755
67 test_expect_success
'diff by ranged tree:path' '
68 run_diff HEAD:one..HEAD:two
70 test_expect_success
'index of ranged tree:path diff' '
71 check_index $sha1_one $sha1_two
73 test_expect_success
'ranged tree:path diff uses filenames as paths' '
76 test_expect_success
'ranged tree:path diff shows mode change' '
77 check_mode 100644 100755
80 test_expect_success
'diff blob against file' '
83 test_expect_success
'index of blob-file diff' '
84 check_index $sha1_one $sha1_two
86 test_expect_success
'blob-file diff uses filename as paths' '
89 test_expect_success FILEMODE
'blob-file diff shows mode change' '
90 check_mode 100644 100755
93 test_expect_success
'blob-file diff prefers filename to sha1' '
94 run_diff $sha1_one two &&