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:
parent
462c2541d7
commit
49e30f7172
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user