fix: properly handle custom branch in chezmoi module (#368)

For posterity: `INIT_BRANCH_FLAG` should be set if `DOTFILE_BRANCH` is not empty and is not equal to `"null"`.
This commit is contained in:
yacoob 2024-11-30 21:28:26 +00:00 committed by GitHub
parent 387a29e127
commit c065b145de
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -19,7 +19,7 @@ fi
DOTFILE_REPOSITORY=$(echo "$1" | yq -I=0 ".repository") # (string)
# The chezmoi repository branch to use.
DOTFILE_BRANCH=$(echo "$1" | yq -I=0 ".branch")
if ! [[ -z "${DOTFILE_BRANCH}" ]] || [[ "${DOTFILE_BRANCH}" == "null" ]]; then
if [[ -n "${DOTFILE_BRANCH}" && "${DOTFILE_BRANCH}" != "null" ]]; then
INIT_BRANCH_FLAG="--branch ${DOTFILE_BRANCH}"
else
INIT_BRANCH_FLAG=""