Merge pull request 'fix: infra: _regen_file does not restore stash if generator fails — compose file lost at temp path (#784)' (#807) from fix/issue-784 into main
All checks were successful
ci/woodpecker/push/ci Pipeline was successful

This commit is contained in:
dev-bot 2026-04-15 19:06:36 +00:00
commit 1d4e28843e

View file

@ -1545,8 +1545,14 @@ _regen_file() {
mv "$target" "$stashed" mv "$target" "$stashed"
fi fi
# Run the generator — it writes $target from scratch # Run the generator — it writes $target from scratch.
"$generator" "$@" # If the generator fails, restore the stashed original so it is not stranded.
if ! "$generator" "$@"; then
if [ -n "$stashed" ]; then
mv "$stashed" "$target"
fi
return 1
fi
if [ -z "$stashed" ]; then if [ -z "$stashed" ]; then
# No previous file — first generation # No previous file — first generation