| 1 |
#!/bin/bash |
| 2 |
set -euo pipefail |
| 3 |
. "$(dirname "$0")"/helpers.sh |
| 4 |
|
| 5 |
new_tmp_dir |
| 6 |
( |
| 7 |
jj debug init-simple |
| 8 |
echo "first" > file |
| 9 |
jj bookmark create first |
| 10 |
jj commit -m 'first' |
| 11 |
echo "second" > file |
| 12 |
jj bookmark create second |
| 13 |
jj commit -m 'second' |
| 14 |
echo "third" > file |
| 15 |
jj bookmark create third |
| 16 |
jj commit -m 'third' |
| 17 |
) >/dev/null 2>&1 |
| 18 |
|
| 19 |
comment "We are in a repo with three commits, all |
| 20 |
editing the same line:" |
| 21 |
run_command "jj log" |
| 22 |
|
| 23 |
run_command "jj diff -r first" |
| 24 |
run_command "jj diff -r second" |
| 25 |
run_command "jj diff -r third" |
| 26 |
|
| 27 |
comment "Let's reorder the second and third commits:" |
| 28 |
run_command_output_redacted "jj rebase -s third --onto first" |
| 29 |
run_command "jj rebase -s second --onto third" |
| 30 |
run_command "jj log" |
| 31 |
comment "The commit labeled \"third\" has a conflict, as expected. What's more |
| 32 |
interesting is that the top commit has no conflict! That's because it |
| 33 |
has the changes from all three commits applied to it. |
| 34 |
|
| 35 |
Let's verify that by looking at its contents:" |
| 36 |
run_command "jj new second" |
| 37 |
run_command "cat file" |
| 38 |
|
| 39 |
comment "Let's now instead make \"second\" and \"third\" |
| 40 |
sibling and merge them:" |
| 41 |
run_command "jj rebase -s second --onto first" |
| 42 |
run_command "jj new second third -m merged" |
| 43 |
run_command "jj log" |
| 44 |
comment "Again, because the merge commit has the |
| 45 |
changes from all three commits, it has no |
| 46 |
conflict." |
| 47 |
|
| 48 |
blank |