From b6eff2218b0b7cc239b35c91a618a0b77d36019d Mon Sep 17 00:00:00 2001 From: Felipe Santos Date: Sun, 28 Apr 2024 23:09:50 -0300 Subject: [PATCH] Skip chezmoi update if branch differs from default --- home/dot_local/bin/executable_full-upgrade.tmpl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/home/dot_local/bin/executable_full-upgrade.tmpl b/home/dot_local/bin/executable_full-upgrade.tmpl index d3d2b2f..3a5be38 100644 --- a/home/dot_local/bin/executable_full-upgrade.tmpl +++ b/home/dot_local/bin/executable_full-upgrade.tmpl @@ -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