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
All checks were successful
ci/woodpecker/push/ci Pipeline was successful
This commit is contained in:
commit
1d4e28843e
1 changed files with 8 additions and 2 deletions
10
bin/disinto
10
bin/disinto
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue