From b134093221f853573c00b7d2fab635311bb25202 Mon Sep 17 00:00:00 2001 From: Alexander Heldt Date: Wed, 25 Nov 2026 09:25:47 +0100 Subject: [PATCH] pinwheel: Show what the branch changes in `.envrc`, not its diff from main The prompt showed `git diff main -- .envrc`, so a branch made before main changed .envrc showed main's new lines as removed, as if the branch deleted them. It now shows the branch's own changes, from where it branched off main, and lists the commits that changed .envrc on main since then. --- hosts/pinwheel/modules/work/wt.zsh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/hosts/pinwheel/modules/work/wt.zsh b/hosts/pinwheel/modules/work/wt.zsh index 04a3d66..80bf255 100644 --- a/hosts/pinwheel/modules/work/wt.zsh +++ b/hosts/pinwheel/modules/work/wt.zsh @@ -103,8 +103,15 @@ _wt_setup() { if git -C "$dir" diff --quiet main -- .envrc; then direnv allow "$dir" else - print -r -- "wt: $dir/.envrc differs from main's:" - git --no-pager -C "$dir" diff main -- .envrc + print -r -- "wt: $dir/.envrc differs from main's" + if ! git -C "$dir" diff --quiet main...HEAD -- .envrc; then + print -r -- "wt: this branch changes it:" + git --no-pager -C "$dir" diff main...HEAD -- .envrc + fi + if [[ -n $(git -C "$dir" log --oneline HEAD..main -- .envrc) ]]; then + print -r -- "wt: main has changed it since this branch was made:" + git --no-pager -C "$dir" log --oneline HEAD..main -- .envrc + fi read -q "reply?wt: allow it? [y/N] " print [[ $reply == y ]] && direnv allow "$dir"