Skip to content

Instantly share code, notes, and snippets.

@thoughtpolice
Last active March 20, 2024 17:28
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thoughtpolice/8f2fd36ae17cd11b8e7bd93a70e31ad6 to your computer and use it in GitHub Desktop.
Save thoughtpolice/8f2fd36ae17cd11b8e7bd93a70e31ad6 to your computer and use it in GitHub Desktop.
my jjconfig.toml
#!/usr/bin/env bash
set -euo pipefail
NAME=$(jj config get user.name)
MAIL=$(jj config get user.email)
CID=$(jj log --no-graph -r @ -T "change_id" | sha256sum | head -c 40)
SIGNSTR="Signed-off-by: ${NAME} <${MAIL}>"
CHGSTR="Change-Id: I${CID}"
contents=$(<"$1")
readarray -t lines <<<"$contents"
body=''
last=''
for x in "${lines[@]}"; do
[[ "$x" =~ ^"JJ:" ]] && continue
[[ "$x" =~ ^"Change-Id:" ]] && continue
[[ "$x" =~ ^"$SIGNSTR" ]] && continue
[[ "$x" == '' ]] && [[ "$last" == '' ]] && continue
last="$x"
body+="$x\n"
done
body+="$SIGNSTR\n"
body+="$CHGSTR\n"
t=$(mktemp)
printf "$body" > "$t"
mv "$t" "$1"
exec hx "$1"
[user]
name = "Austin Seipp"
email = "aseipp@pobox.com"
[core]
#fsmonitor = "watchman"
[format]
tree-level-conflicts = true
[git]
# https://github.com/martinvonz/jj/blob/main/docs/config.md#automatic-local-branch-creation
auto-local-branch = false
push-branch-prefix = "aseipp/push-"
[merge-tools.difft]
diff-args = ["--color=always", "$left", "$right"]
[ui]
default-command = "log"
diff.tool = "difft"
log-synthetic-elided-nodes = true
[aliases]
signoff = [ "--config-toml=ui.editor='/home/austin/.jj-signoff.sh'", "commit" ]
d = [ "diff" ]
s = [ "show", "--tool", "difft" ]
h = [ "help" ]
ws = [ "workspace" ]
ll = [ "log", "-T", "builtin_log_detailed" ]
goto = [ "edit" ]
sl = ["log", "-r", "(trunk()..@):: | (trunk()..@)-"]
remain = [ "rebase", "-d", "main@origin", "-s" ]
bl = ["branch", "list"]
gh-push = [ "git", "push", "--remote", "gh" ]
open = [ "log", "-r", "open()" ]
nom = [ "move", "--to", "@", "--from" ]
yeet = [ "move", "--from", "@", "--to" ]
checkout = [ "new" ]
checkout2 = [ "new" ]
co = [ "new" ]
[revset-aliases]
#'immutable_heads()' = 'trunk() | remote_branches() | tags()'
'trunk()' = 'latest((present(main) | present(master)) & remote_branches())'
'user(x)' = 'author(x) | committer(x)'
'open()' = '(mine() ~ ::trunk()) ~ heads(empty())'
'gh-pages' = 'ancestors(remote_branches(exact:"gh-pages"))'
'wip' = 'description("wip: ")'
'ready' = 'open() ~ wip'
[template-aliases]
'format_short_change_id(id)' = 'id.shortest(2) ++ " ⇜ "'
'format_short_signature(signature)' = '"<" ++ signature.email() ++ ">"'
'format_timestamp(ts)' = '"[" ++ ts.ago() ++ "]"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment