Update dtaft release notes to 1.8.3
[git/jnareb-git.git] / t / t4046-diff-unmerged.sh
blob25d50a654a8904396cfc0078745dd45034aacce2
1 #!/bin/sh
3 test_description='diff with unmerged index entries'
4 . ./test-lib.sh
6 test_expect_success setup '
7 for i in 0 1 2 3
8 do
9 blob=$(echo $i | git hash-object --stdin) &&
10 eval "blob$i=$blob" &&
11 eval "m$i=\"100644 \$blob$i $i\"" || break
12 done &&
13 paths= &&
14 for b in o x
16 for o in o x
18 for t in o x
20 path="$b$o$t" &&
21 case "$path" in ooo) continue ;; esac
22 paths="$paths$path " &&
23 p=" $path" &&
24 case "$b" in x) echo "$m1$p" ;; esac &&
25 case "$o" in x) echo "$m2$p" ;; esac &&
26 case "$t" in x) echo "$m3$p" ;; esac ||
27 break
28 done || break
29 done || break
30 done >ls-files-s.expect &&
31 git update-index --index-info <ls-files-s.expect &&
32 git ls-files -s >ls-files-s.actual &&
33 test_cmp ls-files-s.expect ls-files-s.actual
36 test_expect_success 'diff-files -0' '
37 for path in $paths
39 >"$path" &&
40 echo ":000000 100644 $_z40 $_z40 U $path"
41 done >diff-files-0.expect &&
42 git diff-files -0 >diff-files-0.actual &&
43 test_cmp diff-files-0.expect diff-files-0.actual
46 test_expect_success 'diff-files -1' '
47 for path in $paths
49 >"$path" &&
50 echo ":000000 100644 $_z40 $_z40 U $path" &&
51 case "$path" in
52 x??) echo ":100644 100644 $blob1 $_z40 M $path"
53 esac
54 done >diff-files-1.expect &&
55 git diff-files -1 >diff-files-1.actual &&
56 test_cmp diff-files-1.expect diff-files-1.actual
59 test_expect_success 'diff-files -2' '
60 for path in $paths
62 >"$path" &&
63 echo ":000000 100644 $_z40 $_z40 U $path" &&
64 case "$path" in
65 ?x?) echo ":100644 100644 $blob2 $_z40 M $path"
66 esac
67 done >diff-files-2.expect &&
68 git diff-files -2 >diff-files-2.actual &&
69 test_cmp diff-files-2.expect diff-files-2.actual &&
70 git diff-files >diff-files-default-2.actual &&
71 test_cmp diff-files-2.expect diff-files-default-2.actual
74 test_expect_success 'diff-files -3' '
75 for path in $paths
77 >"$path" &&
78 echo ":000000 100644 $_z40 $_z40 U $path" &&
79 case "$path" in
80 ??x) echo ":100644 100644 $blob3 $_z40 M $path"
81 esac
82 done >diff-files-3.expect &&
83 git diff-files -3 >diff-files-3.actual &&
84 test_cmp diff-files-3.expect diff-files-3.actual
87 test_done