mirror of
https://github.com/martinvonz/jj.git
synced 2024-09-11 13:56:29 +03:00
demos: allow broken pipe when doing jj | head
, fix opid
`jj | head` exits with non-zero code since `head` breaks the pipe. Also, removed `--color=always` from that command as it will shortly become unnecessary. Previosly, this caused the script to stop since it's run with `set -o pipefail`. Also, the operation id recovery code stopped working. We can use `jj debug operation` for this purpose now.
This commit is contained in:
parent
68b8069c5e
commit
eae9e3408d
@ -27,10 +27,10 @@ comment "The repo now looks like this:"
|
|||||||
run_command "jj log"
|
run_command "jj log"
|
||||||
comment "The most recent portion of the operation log
|
comment "The most recent portion of the operation log
|
||||||
is:"
|
is:"
|
||||||
run_command "jj op log --color=always | head"
|
run_command_allow_broken_pipe "jj op log | head"
|
||||||
|
|
||||||
comment "Let's undo that rebase operation:"
|
comment "Let's undo that rebase operation:"
|
||||||
rebase_op=$(jj --color=never op log | grep '^◉ ' | sed '2q;d' | cut -b4-15)
|
rebase_op=$(jj --color=never op log --no-graph -T 'id.short(5)' --limit 1 --at-op @--)
|
||||||
run_command "jj undo $rebase_op"
|
run_command "jj undo $rebase_op"
|
||||||
|
|
||||||
comment "Note that only the rebase was undone, and the
|
comment "Note that only the rebase was undone, and the
|
||||||
|
@ -14,6 +14,21 @@ run_command() {
|
|||||||
eval "$@"
|
eval "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
run_command_allow_broken_pipe() {
|
||||||
|
run_command "$@" || {
|
||||||
|
EXITCODE="$?"
|
||||||
|
case $EXITCODE in
|
||||||
|
3)
|
||||||
|
# `jj` exits with error coded 3 on broken pipe,
|
||||||
|
# which can happen simply because of running
|
||||||
|
# `jj|head`.
|
||||||
|
return 0;;
|
||||||
|
*)
|
||||||
|
return $EXITCODE;;
|
||||||
|
esac
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
blank() {
|
blank() {
|
||||||
echo ""
|
echo ""
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user