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
1 changed files with 3 additions and 3 deletions

View File

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