ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/demos/demo_resolve_conflicts.sh
Ilya Grigoriev 1cc10783a2 demos: update demos as little as possible to regenerate them
This updates demos to the point where they can run without
warnings. Some of them become less clear, this is addressed
(where I noticed it) in follow-up commits.

Fixes #3209
2024-09-05 17:33:46 -07:00

50 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
set -euo pipefail
. "$(dirname "$0")"/helpers.sh
new_tmp_dir
{
jj git clone https://github.com/octocat/Hello-World
cd Hello-World
jj abandon --ignore-immutable test@origin
jj branch forget test
} > /dev/null 2>&1
comment "We are on the master branch of the
octocat/Hello-World repo:"
run_command "jj log"
comment "Let's make an edit that will conflict
when we rebase it:"
run_command "jj describe -m \"README: say which world\""
run_command "echo \"Hello Earth!\" > README"
run_command "jj diff"
# TODO(ilyagr): Get the real shortest prefix of the b1b commit using `jj log
# --no-graph` and the `.shortest()` template function.
#
# This could also be done in demo_git_compat.sh, but that might not be worth it.
comment "We're going to rebase it onto commit b1.
That commit looks like this:"
run_command "jj diff -r b1"
comment "Now rebase:"
run_command "jj rebase -d b1"
comment "That seemed to succeed but we are also told there is now a conflict.
Let's take a look at the repo:"
run_command "jj log"
run_command "jj status"
comment "Indeed, the rebased commit has a conflict. The conflicted file
in the working copy looks like this:"
run_command "cat README"
comment "Now we will resolve the conflict:"
run_command "echo \"Hello earth!\" > README"
comment "The status command no longer reports it:"
run_command "jj status"
blank