]>
Commit | Line | Data |
---|---|---|
63713028 JH |
1 | : Included from t1000-read-tree-m-3way.sh and others |
2 | # Original tree. | |
3 | mkdir Z | |
4 | for a in N D M | |
5 | do | |
6 | for b in N D M | |
7 | do | |
8 | p=$a$b | |
9 | echo This is $p from the original tree. >$p | |
10 | echo This is Z/$p from the original tree. >Z/$p | |
11 | test_expect_success \ | |
12 | "adding test file $p and Z/$p" \ | |
13 | 'git-update-cache --add $p && | |
14 | git-update-cache --add Z/$p' | |
15 | done | |
16 | done | |
17 | echo This is SS from the original tree. >SS | |
18 | test_expect_success \ | |
19 | 'adding test file SS' \ | |
20 | 'git-update-cache --add SS' | |
21 | cat >TT <<\EOF | |
22 | This is a trivial merge sample text. | |
23 | Branch A is expected to upcase this word, here. | |
24 | There are some filler lines to avoid diff context | |
25 | conflicts here, | |
26 | like this one, | |
27 | and this one, | |
28 | and this one is yet another one of them. | |
29 | At the very end, here comes another line, that is | |
30 | the word, expected to be upcased by Branch B. | |
31 | This concludes the trivial merge sample file. | |
32 | EOF | |
33 | test_expect_success \ | |
34 | 'adding test file TT' \ | |
35 | 'git-update-cache --add TT' | |
36 | test_expect_success \ | |
37 | 'prepare initial tree' \ | |
38 | 'tree_O=$(git-write-tree)' | |
39 | ||
40 | ################################################################ | |
41 | # Branch A and B makes the changes according to the above matrix. | |
42 | ||
43 | ################################################################ | |
44 | # Branch A | |
45 | ||
46 | to_remove=$(echo D? Z/D?) | |
47 | rm -f $to_remove | |
48 | test_expect_success \ | |
49 | 'change in branch A (removal)' \ | |
50 | 'git-update-cache --remove $to_remove' | |
51 | ||
52 | for p in M? Z/M? | |
53 | do | |
54 | echo This is modified $p in the branch A. >$p | |
55 | test_expect_success \ | |
56 | 'change in branch A (modification)' \ | |
57 | "git-update-cache $p" | |
58 | done | |
59 | ||
60 | for p in AN AA Z/AN Z/AA | |
61 | do | |
62 | echo This is added $p in the branch A. >$p | |
63 | test_expect_success \ | |
64 | 'change in branch A (addition)' \ | |
65 | "git-update-cache --add $p" | |
66 | done | |
67 | ||
68 | echo This is SS from the modified tree. >SS | |
69 | echo This is LL from the modified tree. >LL | |
70 | test_expect_success \ | |
71 | 'change in branch A (addition)' \ | |
72 | 'git-update-cache --add LL && | |
73 | git-update-cache SS' | |
74 | mv TT TT- | |
75 | sed -e '/Branch A/s/word/WORD/g' <TT- >TT | |
76 | rm -f TT- | |
77 | test_expect_success \ | |
78 | 'change in branch A (edit)' \ | |
79 | 'git-update-cache TT' | |
80 | ||
81 | mkdir DF | |
82 | echo Branch A makes a file at DF/DF, creating a directory DF. >DF/DF | |
83 | test_expect_success \ | |
84 | 'change in branch A (change file to directory)' \ | |
85 | 'git-update-cache --add DF/DF' | |
86 | ||
87 | test_expect_success \ | |
88 | 'recording branch A tree' \ | |
89 | 'tree_A=$(git-write-tree)' | |
90 | ||
91 | ################################################################ | |
92 | # Branch B | |
93 | # Start from O | |
94 | ||
95 | rm -rf [NDMASLT][NDMASLT] Z DF | |
96 | mkdir Z | |
97 | test_expect_success \ | |
98 | 'reading original tree and checking out' \ | |
99 | 'git-read-tree $tree_O && | |
100 | git-checkout-cache -a' | |
101 | ||
102 | to_remove=$(echo ?D Z/?D) | |
103 | rm -f $to_remove | |
104 | test_expect_success \ | |
105 | 'change in branch B (removal)' \ | |
106 | "git-update-cache --remove $to_remove" | |
107 | ||
108 | for p in ?M Z/?M | |
109 | do | |
110 | echo This is modified $p in the branch B. >$p | |
111 | test_expect_success \ | |
112 | 'change in branch B (modification)' \ | |
113 | "git-update-cache $p" | |
114 | done | |
115 | ||
116 | for p in NA AA Z/NA Z/AA | |
117 | do | |
118 | echo This is added $p in the branch B. >$p | |
119 | test_expect_success \ | |
120 | 'change in branch B (addition)' \ | |
121 | "git-update-cache --add $p" | |
122 | done | |
123 | echo This is SS from the modified tree. >SS | |
124 | echo This is LL from the modified tree. >LL | |
125 | test_expect_success \ | |
126 | 'change in branch B (addition and modification)' \ | |
127 | 'git-update-cache --add LL && | |
128 | git-update-cache SS' | |
129 | mv TT TT- | |
130 | sed -e '/Branch B/s/word/WORD/g' <TT- >TT | |
131 | rm -f TT- | |
132 | test_expect_success \ | |
133 | 'change in branch B (modification)' \ | |
134 | 'git-update-cache TT' | |
135 | ||
136 | echo Branch B makes a file at DF. >DF | |
137 | test_expect_success \ | |
138 | 'change in branch B (addition of a file to conflict with directory)' \ | |
139 | 'git-update-cache --add DF' | |
140 | ||
141 | test_expect_success \ | |
142 | 'recording branch B tree' \ | |
143 | 'tree_B=$(git-write-tree)' | |
144 |