server_supports(): parse feature list more carefully
[git/jnareb-git.git] / t / t1012-read-tree-df.sh
bloba6a04b6b90d290a445ed7c33e5928a9a168ed28b
1 #!/bin/sh
3 test_description='read-tree D/F conflict corner cases'
5 . ./test-lib.sh
6 . "$TEST_DIRECTORY"/lib-read-tree.sh
8 maketree () {
10 rm -f .git/index .git/index.lock &&
11 git clean -d -f -f -q -x &&
12 name="$1" &&
13 shift &&
14 for it
16 path=$(expr "$it" : '\([^:]*\)') &&
17 mkdir -p $(dirname "$path") &&
18 echo "$it" >"$path" &&
19 git update-index --add "$path" || exit
20 done &&
21 git tag "$name" $(git write-tree)
25 settree () {
26 rm -f .git/index .git/index.lock &&
27 git clean -d -f -f -q -x &&
28 git read-tree "$1" &&
29 git checkout-index -f -q -u -a &&
30 git update-index --refresh
33 checkindex () {
34 git ls-files -s |
35 sed "s|^[0-7][0-7]* $_x40 \([0-3]\) |\1 |" >current &&
36 cat >expect &&
37 test_cmp expect current
40 test_expect_success setup '
41 maketree O-000 a/b-2/c/d a/b/c/d a/x &&
42 maketree A-000 a/b-2/c/d a/b/c/d a/x &&
43 maketree A-001 a/b-2/c/d a/b/c/d a/b/c/e a/x &&
44 maketree B-000 a/b-2/c/d a/b a/x &&
46 maketree O-010 t-0 t/1 t/2 t=3 &&
47 maketree A-010 t-0 t t=3 &&
48 maketree B-010 t/1: t=3: &&
50 maketree O-020 ds/dma/ioat.c ds/dma/ioat_dca.c &&
51 maketree A-020 ds/dma/ioat/Makefile ds/dma/ioat/registers.h &&
55 test_expect_success '3-way (1)' '
56 settree A-000 &&
57 read_tree_u_must_succeed -m -u O-000 A-000 B-000 &&
58 checkindex <<-EOF
59 3 a/b
60 0 a/b-2/c/d
61 1 a/b/c/d
62 2 a/b/c/d
63 0 a/x
64 EOF
67 test_expect_success '3-way (2)' '
68 settree A-001 &&
69 read_tree_u_must_succeed -m -u O-000 A-001 B-000 &&
70 checkindex <<-EOF
71 3 a/b
72 0 a/b-2/c/d
73 1 a/b/c/d
74 2 a/b/c/d
75 2 a/b/c/e
76 0 a/x
77 EOF
80 test_expect_success '3-way (3)' '
81 settree A-010 &&
82 read_tree_u_must_succeed -m -u O-010 A-010 B-010 &&
83 checkindex <<-EOF
84 2 t
85 1 t-0
86 2 t-0
87 1 t/1
88 3 t/1
89 1 t/2
90 0 t=3
91 EOF
94 test_expect_success '2-way (1)' '
95 settree O-020 &&
96 read_tree_u_must_succeed -m -u O-020 A-020 &&
97 checkindex <<-EOF
98 0 ds/dma/ioat/Makefile
99 0 ds/dma/ioat/registers.h
103 test_done