14 lines
641 B
Bash
14 lines
641 B
Bash
#!/usr/bin/env bash
|
|||
|
|
# Starts a new working commit (`jj new`), unless @ already is a blank one (empty, without a description).
|
||
|
|
# After a push of main, @ is usually already blank: when the pushed commit was @, it became immutable and jj
|
||
|
|
# itself created an empty working commit on top of it (operation "push bookmark main"). An unconditional
|
||
|
|
# `jj new` would then stack a second, useless empty commit.
|
||
|
|
set -euo pipefail
|
||
|
|
. "$(dirname "$0")/common.sh"
|
||
|
|
|
||
|
|
blank=$(jj log -r @ --no-graph -T 'if(empty && description == "", "1", "0")')
|
||
|
|
if [ "$blank" = 1 ]; then
|
||
|
|
info " (@ is already an empty working commit: no new commit)"
|
||
|
|
exit 0
|
||
|
|
fi
|
||
|
|
jj new
|