bips icon indicating copy to clipboard operation
bips copied to clipboard

Use git worktree in diffcheck.sh to avoid mutating the working tree

Open viktorking7 opened this issue 3 months ago • 2 comments

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

viktorking7 avatar Sep 23 '25 11:09 viktorking7

Also, note that this change did not pass CI. Putting this into draft until it does.

jonatack avatar Sep 23 '25 17:09 jonatack

@viktorking7, this is still not passing CI. There is a similar, already existing proposal in #1924 -- would you mind reviewing it, please?

jonatack avatar Sep 24 '25 22:09 jonatack