| 1 |
#!/bin/bash |
| 2 |
set -euo pipefail |
| 3 |
. "$(dirname "$0")"/helpers.sh |
| 4 |
|
| 5 |
new_tmp_dir |
| 6 |
{ |
| 7 |
jj git clone https://github.com/octocat/Hello-World |
| 8 |
cd Hello-World |
| 9 |
jj abandon --ignore-immutable test@origin |
| 10 |
jj bookmark forget test |
| 11 |
} > /dev/null 2>&1 |
| 12 |
|
| 13 |
comment "We are on the master branch of the octocat/Hello-World repo, |
| 14 |
represented by the \"master\" bookmark on the parent commit." |
| 15 |
run_command "jj log" |
| 16 |
|
| 17 |
comment "Let's make an edit that will conflict |
| 18 |
when we rebase it:" |
| 19 |
run_command "jj describe -m \"README: say which world\"" |
| 20 |
run_command "echo \"Hello Earth!\" > README" |
| 21 |
run_command "jj diff" |
| 22 |
|
| 23 |
# TODO(ilyagr): Get the real shortest prefix of the b1b commit using `jj log |
| 24 |
# --no-graph` and the `.shortest()` template function. |
| 25 |
# |
| 26 |
# This could also be done in demo_git_compat.sh, but that might not be worth it. |
| 27 |
comment "We're going to rebase it onto commit b1. |
| 28 |
That commit looks like this:" |
| 29 |
run_command "jj diff -r b1" |
| 30 |
|
| 31 |
comment "Now rebase:" |
| 32 |
run_command "jj rebase --onto b1" |
| 33 |
|
| 34 |
comment "That seemed to succeed but we are also told there is now a conflict. |
| 35 |
Let's take a look at the repo:" |
| 36 |
run_command "jj log" |
| 37 |
run_command "jj status" |
| 38 |
|
| 39 |
comment "Indeed, the rebased commit has a conflict. The conflicted file |
| 40 |
in the working copy looks like this:" |
| 41 |
run_command "cat README" |
| 42 |
|
| 43 |
comment "Now we will resolve the conflict:" |
| 44 |
run_command "echo \"Hello earth!\" > README" |
| 45 |
|
| 46 |
comment "The status command no longer reports it:" |
| 47 |
run_command "jj status" |
| 48 |
|
| 49 |
blank |