Skip to content

Commit

Permalink
Merge pull request #5130 from unisonweb/24-06-25-merge-bug-transcript
Browse files Browse the repository at this point in the history
add transcript that demonstrates bug in merge
  • Loading branch information
mitchellwrosen committed Jun 25, 2024
2 parents 7172bb8 + ae54637 commit eca0755
Show file tree
Hide file tree
Showing 2 changed files with 228 additions and 0 deletions.
65 changes: 65 additions & 0 deletions unison-src/transcripts/merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -1518,3 +1518,68 @@ project/main> view Foo
```ucm:hide
.> project.delete project
```

### Dependent that doesn't need to be in the file

This test demonstrates a bug.


```ucm:hide
project/alice> builtins.mergeio lib.builtins
```

In the LCA, we have `foo` with dependent `bar`, and `baz`.

```unison
foo : Nat
foo = 17
bar : Nat
bar = foo + foo
baz : Text
baz = "lca"
```

```ucm
project/alice> add
project/alice> branch bob
```

On Bob, we update `baz` to "bob".

```unison
baz : Text
baz = "bob"
```

```ucm
project/bob> update
```

On Alice, we update `baz` to "alice" (conflict), but also update `foo` (unconflicted), which propagates to `bar`.

```unison
foo : Nat
foo = 18
baz : Text
baz = "alice"
```

```ucm
project/alice> update
```

When we try to merge Bob into Alice, we should see both versions of `baz`, with Alice's unconflicted `foo` and `bar` in
the underlying namespace.

```ucm:error
project/alice> merge /bob
```

But `bar` was put into the scratch file instead.

```ucm:hide
.> project.delete project
```
163 changes: 163 additions & 0 deletions unison-src/transcripts/merge.output.md
Original file line number Diff line number Diff line change
Expand Up @@ -1793,3 +1793,166 @@ project/main> view Foo
type Foo = Bar
```
### Dependent that doesn't need to be in the file

This test demonstrates a bug.


In the LCA, we have `foo` with dependent `bar`, and `baz`.

```unison
foo : Nat
foo = 17
bar : Nat
bar = foo + foo
baz : Text
baz = "lca"
```

```ucm
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These new definitions are ok to `add`:
bar : Nat
baz : Text
foo : Nat
```
```ucm
project/alice> add
⍟ I've added these definitions:
bar : Nat
baz : Text
foo : Nat
project/alice> branch bob
Done. I've created the bob branch based off of alice.
Tip: To merge your work back into the alice branch, first
`switch /alice` then `merge /bob`.
```
On Bob, we update `baz` to "bob".

```unison
baz : Text
baz = "bob"
```

```ucm
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These names already exist. You can `update` them to your
new definition:
baz : Text
```
```ucm
project/bob> update
Okay, I'm searching the branch for code that needs to be
updated...
Done.
```
On Alice, we update `baz` to "alice" (conflict), but also update `foo` (unconflicted), which propagates to `bar`.

```unison
foo : Nat
foo = 18
baz : Text
baz = "alice"
```

```ucm
Loading changes detected in scratch.u.
I found and typechecked these definitions in scratch.u. If you
do an `add` or `update`, here's how your codebase would
change:
⍟ These names already exist. You can `update` them to your
new definition:
baz : Text
foo : Nat
```
```ucm
project/alice> update
Okay, I'm searching the branch for code that needs to be
updated...
That's done. Now I'm making sure everything typechecks...
Everything typechecks, so I'm saving the results...
Done.
```
When we try to merge Bob into Alice, we should see both versions of `baz`, with Alice's unconflicted `foo` and `bar` in
the underlying namespace.

```ucm
project/alice> merge /bob
I couldn't automatically merge project/bob into project/alice.
However, I've added the definitions that need attention to the
top of scratch.u.
When you're done, you can run
merge.commit
to merge your changes back into alice and delete the temporary
branch. Or, if you decide to cancel the merge instead, you can
run
delete.branch /merge-bob-into-alice
to delete the temporary branch and switch back to alice.
```
```unison:added-by-ucm scratch.u
-- project/alice
baz : Text
baz = "alice"
-- project/bob
baz : Text
baz = "bob"
-- The definitions below are not conflicted, but they each depend on one or more
-- conflicted definitions above.
bar : Nat
bar =
use Nat +
foo + foo
```

But `bar` was put into the scratch file instead.

0 comments on commit eca0755

Please sign in to comment.