Skip to content

Commit

Permalink
Auto-skip chezmoi update in full-upgrade on unpushed changes
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrs committed Apr 28, 2024
1 parent 442b417 commit b7e6235
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions home/dot_local/bin/executable_full-upgrade.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,18 @@ if [[ "${CONTINUE_FROM_DOTFILES:-false}" == false ]]; then

if chezmoi --version &>/dev/null; then
log_task "Updating dotfiles"
# Pull latest changes from dotfiles repo

if chezmoi git -- status --porcelain | grep -q .; then
log_manual_action "Not running chezmoi update as uncommitted dotfiles changes were found"
log_manual_action "Skipping chezmoi update as uncommitted changes were found"
elif ! chezmoi git -- branch --show-current | grep -q .; then
log_manual_action "Skipping chezmoi update as the current branch could not be determined"
elif chezmoi git -- log '@{u}..' | grep -q .; then
log_manual_action "Skipping chezmoi update as unpushed changes were found"
else
# Pull latest changes from dotfiles repo
c chezmoi update --apply=false
fi

# Apply changes to chezmoi config
c chezmoi init --force
# Apply the rest
Expand Down

0 comments on commit b7e6235

Please sign in to comment.