test/lib/create-git-repo: fix empty var expansion

When `amend` is empty, expand it to nothing instead of an empty
string (which causes a git error).
This commit is contained in:
Erik Arvstedt 2022-09-02 15:12:06 +02:00
parent 462c2541d7
commit 49e30f7172
No known key found for this signature in database
GPG Key ID: 33312B944DD97846

View File

@ -2,14 +2,14 @@
(
# shellcheck disable=SC2154,SC2164
cd "$scriptDir/.."
amend=--amend
amend=(--amend)
if [[ ! -e .git ]] || ! git rev-parse HEAD 2>/dev/null; then
git init
amend=
amend=()
fi
git add .
if ! git diff --quiet --cached; then
git commit -a "$amend" -m -
git commit -a "${amend[@]}" -m -
fi
) >/dev/null