[!exec:git] skip 'git not found in $PATH'

mkgitconfig
mkhomedir golden
mkhomedir

exec git init --bare $WORK/dotfiles.git

chezmoi init file://$WORK/dotfiles.git

# create a commit
chezmoi add $HOME${/}.file
chezmoi git add dot_file
chezmoi git commit -- --message 'Add dot_file'
chezmoi git push

chhome home2/user
mkgitconfig
chezmoi init --apply --force file://$WORK/dotfiles.git
cmp $HOME/.file golden/.file

# create and push a new commit
chhome home/user
edit $CHEZMOISOURCEDIR/dot_file
chezmoi git -- add dot_file
chezmoi git -- commit -m 'Update dot_file'
chezmoi git -- push

# test chezmoi update
chhome home2/user
chezmoi update
grep -count=1 '# edited' $HOME/.file

# create and push a new commit
chhome home/user
edit $CHEZMOISOURCEDIR/dot_file
chezmoi git -- add dot_file
chezmoi git -- commit -m 'Update dot_file'
chezmoi git -- push

# test chezmoi update --apply=false
chhome home2/user
chezmoi update --apply=false
grep -count=1 '# edited' $HOME/.file
chezmoi apply --force
grep -count=2 '# edited' $HOME/.file
