diff --git a/modules/home/default.nix b/modules/home/default.nix index 6e9a26196dcdf34958881eb89a2316560317139d..9b0a348c969264f35c546f9528386fba2a600f38 100644 --- a/modules/home/default.nix +++ b/modules/home/default.nix @@ -144,11 +144,14 @@ in signing = lib.mkIf (config.programs.git.signing.key != null) { inherit (config.programs.git.signing) key; backend = "gpg"; - behavior = "own"; + # signatures are slow, compute them on push instead of on change. + behavior = "drop"; }; git = { - sign-on-push = true; - push-new-bookmarks = true; + sign-on-push = config.programs.git.signing.key != null; + }; + remotes.origin = { + auto-track-bookmarks = "glob:*"; }; ui = { default-command = "log"; diff --git a/users/clover/home.nix b/users/clover/home.nix index 72bcfaec101f041eb4446cb5874a40c9ea3ff74b..39e5db31eb601046124b1fdc6db20717a108aa51 100644 --- a/users/clover/home.nix +++ b/users/clover/home.nix @@ -1,4 +1,9 @@ -{ pkgs, host, ... }: +{ + pkgs, + host, + lib, + ... +}: let hostServer = false; in @@ -66,8 +71,7 @@ in jf = "jj git fetch"; e = "jj edit"; d = "jj desc"; - bup = "jj b m --from 'parents(@)' --to '@'"; - push = "jj git push"; + bup = "jj b m --from 'heads(::@- & bookmarks())' --to '@'"; moveself = "jj rebase -r @ -d"; logall = "jj log -r 'all()'"; cherry = "jj git fetch && jj split -i -p -m 'SPLIT_CHANGES' && jj edit -r 'description(\"SPLIT_CHANGES\")' && jj desc -m '' --edit"; @@ -83,19 +87,58 @@ in uv run --project "$dirname" "$@" } + function bun() { + if [[ "$1" = "build" ]]; then + command bun run "$@" + elif [[ "$1" = "bundle" ]]; then + shift + command bun build "$@" + else + command bun "$@" + fi + } + + function jj() { + if [[ "$*" = "git push"* ]] && [[ "$*" != *"--dry-run"* ]]; then + command jj "$@" --dry-run + printf "Press any key to continue... " + read -r + command jj "$@" + else + command jj "$@" + fi + } + + function push() { + command jj git push "$@" --dry-run + printf "Press any key to continue... " + read -r + if bash -c 'cd $(jj workspace root); bun local-ci'; then + command jj git push "$@" + fi + } + function pr() { message=$(jj log -r '@' -T 'description' --no-graph) if [[ -z "$message" ]] || [[ "$message" = "WIP:"* ]]; then jj desc + message=$(jj log -r '@' -T 'description' --no-graph) + if [[ -z "$message" ]] || [[ "$message" = "WIP:"* ]]; then + exit + fi fi if [ -n "$1" ]; then - jj git push --named "clo/$1"=@ - branch="clo/$1" + if [[ "clo"/* = "$1" ]]; then + branch="$1"; + else + branch="clo/$1" + fi + command jj git push --named "$branch"=@ else - branch="$(jj log -r '@' -T '"clo/push-" ++ change_id.short()' --no-graph)" - jj git push -c @ + command jj git push -c @ + branch="$(jj log -r '@-' -T 'bookmarks.join("\n")' --no-graph | head -1)" fi - open "$(git remote get-url origin | sed 's/git@github\.com:/https:\/\/github.com\//' | sed 's/\.git$//')/compare/master...$branch" + open "$(git remote get-url origin | sed 's/git@github\.com:/https:\/\/github.com\//' | sed 's/\.git$//')/compare/master...$branch?quick_pull=1&labels=awaiting+code+review,awaiting+functionality+review&body=" } ''; }; @@ -104,7 +147,7 @@ in git.userEmail = "git@paperclover.net"; git.signing = { signByDefault = true; - key = "C0D577FD799F9D11"; + key = lib.mkDefault "C0D577FD799F9D11"; }; jujutsu = { @@ -175,7 +218,7 @@ in }; # ui.graph.style = "square"; revsets = { - log = "ancestors(description(regex:\"^(WIP:|\\\\s+$)\"):: | working_copies() | bookmarks(\"master\")::remote_bookmarks(\"master\") | bookmarks(glob:\"clo/*\")::, 5)"; + log = "ancestors(description(regex:\"^(WIP:|\\\\s+$)\"):: | working_copies() | bookmarks(exact:\"master\")::remote_bookmarks(exact:\"master\") | bookmarks(glob:\"clo/*\")::, 5)"; short-prefixes = "(trunk()..@)::"; }; # templates.log = "hl_wip(self)"; diff --git a/users/clover/work/home.nix b/users/clover/work/home.nix index 3dcb3ea9c5e53de6b451d59bbcbb3d78a1cff0cf..63ec7800722bf7336ced60fcb9f0b40fd150051f 100644 --- a/users/clover/work/home.nix +++ b/users/clover/work/home.nix @@ -8,6 +8,7 @@ } ''; }; + programs.git.signing.key = "CE485807AE4068AF8508C8DC5CBB21841C7920AD"; home.packages = with pkgs; [ (bun.overrideAttrs (_: rec { version = "1.3.0";