Skip to content

Commit 0366a79

Browse files
committed
Print "What's new?" on full-upgrade for dotfiles commits
1 parent ad571a7 commit 0366a79

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

home/dot_local/bin/executable_full-upgrade.tmpl

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ if [[ "${CONTINUE_FROM_DOTFILES:-false}" == false ]]; then
2929
if chezmoi --version &>/dev/null; then
3030
log_task "Updating dotfiles"
3131

32+
dotfiles_old_hash="$(chezmoi git -- rev-parse HEAD 2>/dev/null || true)"
33+
3234
if chezmoi git -- status --porcelain | grep -q .; then
3335
log_manual_action "Skipping chezmoi update as uncommitted changes were found"
3436
elif
@@ -43,6 +45,20 @@ if [[ "${CONTINUE_FROM_DOTFILES:-false}" == false ]]; then
4345
c chezmoi update --apply=false
4446
fi
4547

48+
dotfiles_new_hash="$(chezmoi git -- rev-parse HEAD 2>/dev/null || true)"
49+
if [[ -n "${dotfiles_old_hash}" && "${dotfiles_old_hash}" != "${dotfiles_new_hash}" ]]; then
50+
log_green "📢 What's new?"
51+
echo >&2
52+
PAGER="cat" chezmoi git -- log \
53+
--oneline \
54+
--no-decorate \
55+
--color=always \
56+
--format="%C(yellow)%h%Creset %C(bold white)%s%Creset %C(dim)(%cr)%Creset" \
57+
"${dotfiles_old_hash}..${dotfiles_new_hash}" >&2
58+
echo >&2
59+
fi
60+
unset dotfiles_old_hash dotfiles_new_hash
61+
4662
# Apply changes to chezmoi config
4763
c chezmoi init --force
4864
# Apply the rest

0 commit comments

Comments
 (0)