]>
Commit | Line | Data |
---|---|---|
095ce953 JH |
1 | #!/bin/sh |
2 | ||
3 | test_description='diff with unmerged index entries' | |
16d4bd4f ÆAB |
4 | |
5 | TEST_PASSES_SANITIZE_LEAK=true | |
095ce953 JH |
6 | . ./test-lib.sh |
7 | ||
8 | test_expect_success setup ' | |
9 | for i in 0 1 2 3 | |
10 | do | |
11 | blob=$(echo $i | git hash-object --stdin) && | |
12 | eval "blob$i=$blob" && | |
e6821d09 | 13 | eval "m$i=\"100644 \$blob$i $i\"" || return 1 |
095ce953 JH |
14 | done && |
15 | paths= && | |
16 | for b in o x | |
17 | do | |
18 | for o in o x | |
19 | do | |
20 | for t in o x | |
21 | do | |
22 | path="$b$o$t" && | |
74d2f569 | 23 | case "$path" in ooo) continue ;; esac && |
095ce953 JH |
24 | paths="$paths$path " && |
25 | p=" $path" && | |
26 | case "$b" in x) echo "$m1$p" ;; esac && | |
27 | case "$o" in x) echo "$m2$p" ;; esac && | |
28 | case "$t" in x) echo "$m3$p" ;; esac || | |
e6821d09 JK |
29 | return 1 |
30 | done | |
31 | done | |
095ce953 JH |
32 | done >ls-files-s.expect && |
33 | git update-index --index-info <ls-files-s.expect && | |
34 | git ls-files -s >ls-files-s.actual && | |
35 | test_cmp ls-files-s.expect ls-files-s.actual | |
36 | ' | |
37 | ||
38 | test_expect_success 'diff-files -0' ' | |
39 | for path in $paths | |
40 | do | |
41 | >"$path" && | |
cbe1d9d6 | 42 | echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" || return 1 |
095ce953 JH |
43 | done >diff-files-0.expect && |
44 | git diff-files -0 >diff-files-0.actual && | |
45 | test_cmp diff-files-0.expect diff-files-0.actual | |
46 | ' | |
47 | ||
48 | test_expect_success 'diff-files -1' ' | |
49 | for path in $paths | |
50 | do | |
51 | >"$path" && | |
8125a58b | 52 | echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" && |
095ce953 | 53 | case "$path" in |
8125a58b | 54 | x??) echo ":100644 100644 $blob1 $ZERO_OID M $path" |
cbe1d9d6 | 55 | esac || return 1 |
095ce953 JH |
56 | done >diff-files-1.expect && |
57 | git diff-files -1 >diff-files-1.actual && | |
58 | test_cmp diff-files-1.expect diff-files-1.actual | |
59 | ' | |
60 | ||
61 | test_expect_success 'diff-files -2' ' | |
62 | for path in $paths | |
63 | do | |
64 | >"$path" && | |
8125a58b | 65 | echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" && |
095ce953 | 66 | case "$path" in |
8125a58b | 67 | ?x?) echo ":100644 100644 $blob2 $ZERO_OID M $path" |
cbe1d9d6 | 68 | esac || return 1 |
095ce953 JH |
69 | done >diff-files-2.expect && |
70 | git diff-files -2 >diff-files-2.actual && | |
71 | test_cmp diff-files-2.expect diff-files-2.actual && | |
72 | git diff-files >diff-files-default-2.actual && | |
73 | test_cmp diff-files-2.expect diff-files-default-2.actual | |
74 | ' | |
75 | ||
76 | test_expect_success 'diff-files -3' ' | |
77 | for path in $paths | |
78 | do | |
79 | >"$path" && | |
8125a58b | 80 | echo ":000000 100644 $ZERO_OID $ZERO_OID U $path" && |
095ce953 | 81 | case "$path" in |
8125a58b | 82 | ??x) echo ":100644 100644 $blob3 $ZERO_OID M $path" |
cbe1d9d6 | 83 | esac || return 1 |
095ce953 JH |
84 | done >diff-files-3.expect && |
85 | git diff-files -3 >diff-files-3.actual && | |
86 | test_cmp diff-files-3.expect diff-files-3.actual | |
87 | ' | |
88 | ||
89 | test_done |