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.
This commit is contained in:
Alexander Heldt committed 2026-11-25 09:25:47 +01:00
1 parent b794227722
commit b134093221
1 file changed
+9 -2
+9 -2
View File
@@ -103,8 +103,15 @@ _wt_setup() {
if git -C "$dir" diff --quiet main -- .envrc; then if git -C "$dir" diff --quiet main -- .envrc; then
direnv allow "$dir" direnv allow "$dir"
else else
print -r -- "wt: $dir/.envrc differs from main's:" print -r -- "wt: $dir/.envrc differs from main's"
git --no-pager -C "$dir" diff main -- .envrc 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] " read -q "reply?wt: allow it? [y/N] "
print print
[[ $reply == y ]] && direnv allow "$dir" [[ $reply == y ]] && direnv allow "$dir"