Skip to content

Commit ef02077

Browse files
add failing transcript
1 parent b08cbb0 commit ef02077

File tree

2 files changed

+384
-0
lines changed

2 files changed

+384
-0
lines changed

unison-src/transcripts/fix-5326.md

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
```ucm
2+
scratch/main> builtins.merge lib.builtin
3+
```
4+
5+
```unison
6+
x = 1
7+
```
8+
9+
```ucm
10+
scratch/main> update
11+
scratch/main> branch foo
12+
scratch/main>
13+
```
14+
15+
```
16+
main, foo
17+
|
18+
A
19+
```
20+
21+
```unison
22+
x = 2
23+
```
24+
25+
```ucm
26+
scratch/main> update
27+
scratch/main> branch bar
28+
scratch/main>
29+
```
30+
31+
```
32+
main, bar
33+
|
34+
| foo
35+
| |
36+
B - A
37+
```
38+
39+
```unison
40+
x = 3
41+
```
42+
43+
```ucm
44+
scratch/main> update
45+
```
46+
47+
```
48+
main
49+
|
50+
| bar foo
51+
| | |
52+
C - B - A
53+
```
54+
55+
```unison
56+
x = 4
57+
```
58+
59+
```ucm
60+
scratch/main> update
61+
scratch/foo>
62+
```
63+
64+
```
65+
main
66+
|
67+
| bar foo
68+
| | |
69+
D - C - B - A
70+
```
71+
72+
```unison
73+
y = 5
74+
```
75+
76+
```ucm
77+
scratch/foo> update
78+
```
79+
80+
```
81+
main
82+
|
83+
| bar
84+
| |
85+
D - C - B - A
86+
/
87+
E
88+
|
89+
foo
90+
```
91+
92+
```ucm
93+
scratch/main> merge /foo
94+
```
95+
96+
```
97+
main
98+
|
99+
| bar
100+
| |
101+
F - D - C - B - A
102+
\ /
103+
----------- E
104+
|
105+
foo
106+
```
107+
108+
```ucm:error
109+
scratch/main> merge /bar
110+
```
111+
112+
This should be a fast-forward, but we get this shape instead (which fails due to conflicts), because we incorrectly
113+
compute `LCA(main, bar)` as `A`, not `B`.
114+
115+
```
116+
main
117+
|
118+
| ------------ bar
119+
| / \|
120+
G - F - D - C - B - A
121+
\ /
122+
----------- E
123+
|
124+
foo
125+
```
Lines changed: 259 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,259 @@
1+
``` ucm
2+
scratch/main> builtins.merge lib.builtin
3+
4+
Done.
5+
6+
```
7+
``` unison
8+
x = 1
9+
```
10+
11+
``` ucm
12+
13+
Loading changes detected in scratch.u.
14+
15+
I found and typechecked these definitions in scratch.u. If you
16+
do an `add` or `update`, here's how your codebase would
17+
change:
18+
19+
⍟ These new definitions are ok to `add`:
20+
21+
x : Nat
22+
23+
```
24+
``` ucm
25+
scratch/main> update
26+
27+
Okay, I'm searching the branch for code that needs to be
28+
updated...
29+
30+
Done.
31+
32+
scratch/main> branch foo
33+
34+
Done. I've created the foo branch based off of main.
35+
36+
Tip: To merge your work back into the main branch, first
37+
`switch /main` then `merge /foo`.
38+
39+
```
40+
```
41+
main, foo
42+
|
43+
A
44+
```
45+
46+
``` unison
47+
x = 2
48+
```
49+
50+
``` ucm
51+
52+
Loading changes detected in scratch.u.
53+
54+
I found and typechecked these definitions in scratch.u. If you
55+
do an `add` or `update`, here's how your codebase would
56+
change:
57+
58+
⍟ These names already exist. You can `update` them to your
59+
new definition:
60+
61+
x : Nat
62+
63+
```
64+
``` ucm
65+
scratch/main> update
66+
67+
Okay, I'm searching the branch for code that needs to be
68+
updated...
69+
70+
Done.
71+
72+
scratch/main> branch bar
73+
74+
Done. I've created the bar branch based off of main.
75+
76+
Tip: To merge your work back into the main branch, first
77+
`switch /main` then `merge /bar`.
78+
79+
```
80+
```
81+
main, bar
82+
|
83+
| foo
84+
| |
85+
B - A
86+
```
87+
88+
``` unison
89+
x = 3
90+
```
91+
92+
``` ucm
93+
94+
Loading changes detected in scratch.u.
95+
96+
I found and typechecked these definitions in scratch.u. If you
97+
do an `add` or `update`, here's how your codebase would
98+
change:
99+
100+
⍟ These names already exist. You can `update` them to your
101+
new definition:
102+
103+
x : Nat
104+
105+
```
106+
``` ucm
107+
scratch/main> update
108+
109+
Okay, I'm searching the branch for code that needs to be
110+
updated...
111+
112+
Done.
113+
114+
```
115+
```
116+
main
117+
|
118+
| bar foo
119+
| | |
120+
C - B - A
121+
```
122+
123+
``` unison
124+
x = 4
125+
```
126+
127+
``` ucm
128+
129+
Loading changes detected in scratch.u.
130+
131+
I found and typechecked these definitions in scratch.u. If you
132+
do an `add` or `update`, here's how your codebase would
133+
change:
134+
135+
⍟ These names already exist. You can `update` them to your
136+
new definition:
137+
138+
x : Nat
139+
140+
```
141+
``` ucm
142+
scratch/main> update
143+
144+
Okay, I'm searching the branch for code that needs to be
145+
updated...
146+
147+
Done.
148+
149+
```
150+
```
151+
main
152+
|
153+
| bar foo
154+
| | |
155+
D - C - B - A
156+
```
157+
158+
``` unison
159+
y = 5
160+
```
161+
162+
``` ucm
163+
164+
Loading changes detected in scratch.u.
165+
166+
I found and typechecked these definitions in scratch.u. If you
167+
do an `add` or `update`, here's how your codebase would
168+
change:
169+
170+
⍟ These new definitions are ok to `add`:
171+
172+
y : Nat
173+
174+
```
175+
``` ucm
176+
scratch/foo> update
177+
178+
Okay, I'm searching the branch for code that needs to be
179+
updated...
180+
181+
Done.
182+
183+
```
184+
```
185+
main
186+
|
187+
| bar
188+
| |
189+
D - C - B - A
190+
/
191+
E
192+
|
193+
foo
194+
```
195+
196+
``` ucm
197+
scratch/main> merge /foo
198+
199+
I merged scratch/foo into scratch/main.
200+
201+
```
202+
```
203+
main
204+
|
205+
| bar
206+
| |
207+
F - D - C - B - A
208+
\ /
209+
----------- E
210+
|
211+
foo
212+
```
213+
214+
``` ucm
215+
scratch/main> merge /bar
216+
217+
I couldn't automatically merge scratch/bar into scratch/main.
218+
However, I've added the definitions that need attention to the
219+
top of scratch.u.
220+
221+
When you're done, you can run
222+
223+
merge.commit
224+
225+
to merge your changes back into main and delete the temporary
226+
branch. Or, if you decide to cancel the merge instead, you can
227+
run
228+
229+
delete.branch /merge-bar-into-main
230+
231+
to delete the temporary branch and switch back to main.
232+
233+
```
234+
``` unison:added-by-ucm scratch.u
235+
-- scratch/main
236+
x : Nat
237+
x = 4
238+
239+
-- scratch/bar
240+
x : Nat
241+
x = 2
242+
243+
```
244+
245+
This should be a fast-forward, but we get this shape instead (which fails due to conflicts), because we incorrectly
246+
compute `LCA(main, bar)` as `A`, not `B`.
247+
248+
```
249+
main
250+
|
251+
| ------------ bar
252+
| / \|
253+
G - F - D - C - B - A
254+
\ /
255+
----------- E
256+
|
257+
foo
258+
```
259+

0 commit comments

Comments
 (0)