Problem
bashunit init comments out any existing BASHUNIT_BOOTSTRAP and appends a
fresh one — unconditionally, even when the value is unchanged. Three runs:
#BASHUNIT_BOOTSTRAP=tests/bootstrap.sh
#BASHUNIT_BOOTSTRAP=tests/bootstrap.sh
BASHUNIT_BOOTSTRAP=tests/bootstrap.sh
The scaffolded files are idempotent, so re-running init is otherwise safe and
people do it. Only .env grows.
.env is also the one file init writes without saying so — the other
three print > Created …, so someone reviewing what init touched before
committing would miss it.
Fix
Skip the rewrite when the setting already has the intended value, and report
each .env outcome:
> Created .env # first run
> .env already sets BASHUNIT_BOOTSTRAP # re-run, unchanged
> Updated .env # value differed
Replacing a different value keeps working — that is what the comment-and-append
logic is for.
Problem
bashunit initcomments out any existingBASHUNIT_BOOTSTRAPand appends afresh one — unconditionally, even when the value is unchanged. Three runs:
The scaffolded files are idempotent, so re-running
initis otherwise safe andpeople do it. Only
.envgrows..envis also the one fileinitwrites without saying so — the otherthree print
> Created …, so someone reviewing what init touched beforecommitting would miss it.
Fix
Skip the rewrite when the setting already has the intended value, and report
each
.envoutcome:Replacing a different value keeps working — that is what the comment-and-append
logic is for.