fix(chezmoi): Properly use default branch
`yq` outputs "null" string when no results are found, so it's not an empty string. Branch "null" is passed as custom branch, which very likely doesn't exist in user's chezmoi repo. So to solve this issue, set "if string is empty or contains string "null", disable custom branch, otherwise enable"
This commit is contained in:
parent
f176a3516e
commit
a166afed8a
1 changed files with 3 additions and 3 deletions
|
|
@ -19,10 +19,10 @@ 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 [[ -n ${DOTFILE_BRANCH} ]]; then
|
||||
INIT_BRANCH_FLAG="--branch ${DOTFILE_BRANCH}"
|
||||
if ! [[ -z "${DOTFILE_BRANCH}" ]] || [[ "${DOTFILE_BRANCH}" == "null" ]]; then
|
||||
INIT_BRANCH_FLAG="--branch ${DOTFILE_BRANCH}"
|
||||
else
|
||||
INIT_BRANCH_FLAG=""
|
||||
INIT_BRANCH_FLAG=""
|
||||
fi
|
||||
|
||||
# If true, chezmoi services will be enabled for all logged in users, and users with lingering enabled. (default: true)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue