bips
bips copied to clipboard
Use git worktree in diffcheck.sh to avoid mutating the working tree
Summary
Replace git checkout HEAD^ with a temporary detached git worktree in scripts/diffcheck.sh. This eliminates side effects on the current branch and ensures clean cleanup.
Changes
- Add strict shell mode: set -Eeuo pipefail
- Use mktemp for temp files/dirs
- Build previous commit table in a detached worktree
- Add trap cleanup to remove worktree and temps
Why
- Prevents leaving the repo in detached HEAD
- Avoids accidental loss of uncommitted changes
- More CI-friendly and reproducible
Also, note that this change did not pass CI. Putting this into draft until it does.
@viktorking7, this is still not passing CI. There is a similar, already existing proposal in #1924 -- would you mind reviewing it, please?