Skip to content

Commit

Permalink
Skip chezmoi update if branch differs from default
Browse files Browse the repository at this point in the history
  • Loading branch information
felipecrs committed Apr 29, 2024
1 parent 9b8abec commit b6eff22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions home/dot_local/bin/executable_full-upgrade.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,11 @@ if [[ "${CONTINUE_FROM_DOTFILES:-false}" == false ]]; then

if chezmoi git -- status --porcelain | grep -q .; then
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
# shellcheck disable=SC2312
[[ "origin/$(chezmoi git -- rev-parse --abbrev-ref HEAD)" != "$(git rev-parse --abbrev-ref origin/HEAD)" ]]
then
log_manual_action "Skipping chezmoi update as the current branch is not the default branch"
elif chezmoi git -- log '@{u}..' | grep -q .; then
log_manual_action "Skipping chezmoi update as unpushed changes were found"
else
Expand Down

0 comments on commit b6eff22

Please sign in to comment.