config.toml.tmpl

 1[user]
 2name = "Amolith"
 3email = "amolith@secluded.site"
 4
 5[ui]
 6pager = "delta"
 7editor = "vim"
 8show-cryptographic-signatures = true
 9
10[signing]
11backend = "ssh"
12{{- if ne .chezmoi.username "exedev" }}
13behavior = "drop"
14{{- end }}
15{{- if eq .chezmoi.hostname "angmar" }}
16key = "{{ .chezmoi.homeDir }}/.ssh/yk-stationary.pub"
17{{- else }}
18key = "{{ .chezmoi.homeDir }}/.ssh/yk-mobile.pub"
19{{- end }}
20
21[signing.backends.ssh]
22allowed-signers = "/home/amolith/.ssh/allowed_signers"
23
24[git]
25{{- if ne .chezmoi.username "exedev" }}
26# Keep built-in push signing off so jj doesn't sign commits authored by others.
27sign-on-push = false
28{{- end }}
29
30[revset-aliases]
31'closest_bookmark(to)' = 'heads(::to & bookmarks())'
32
33[aliases]
34tug = ["bookmark", "move", "--from", "closest_bookmark(@-)", "--to", "@-"]
35{{- if ne .chezmoi.username "exedev" }}
36# Use `jj push` (this alias), not `jj git push`.
37# It signs only our own mutable unsigned commits in the push range, then pushes.
38push = ["util", "exec", "--", "bash", "-c", """
39set -euo pipefail
40
41remote=""
42args=("$@")
43i=0
44while [ "$i" -lt "$#" ]; do
45  arg="${args[$i]}"
46  case "$arg" in
47    --remote=*)
48      remote="${arg#--remote=}"
49      ;;
50    --remote)
51      i=$((i + 1))
52      if [ "$i" -lt "$#" ]; then
53        remote="${args[$i]}"
54      fi
55      ;;
56  esac
57  i=$((i + 1))
58done
59
60if [ -z "$remote" ]; then
61  remote="$(jj config get git.push 2>/dev/null || true)"
62fi
63if [ -z "$remote" ]; then
64  remote="origin"
65fi
66
67jj sign -r "mine() & mutable() & (remote_bookmarks(remote=${remote})..closest_bookmark(@))"
68jj git push "$@"
69""", ""]
70{{- end }}