From 0912ba47242d8d83a90aa774a5ab2836f8b28d21 Mon Sep 17 00:00:00 2001 From: Shrikant Sharat Date: Fri, 20 Jul 2012 16:29:57 +0530 Subject: [PATCH] Print a summary of changes pulled, on -update. Running an `antigen-update` will now print a --oneline git log of the changes that are pulled. Helpful if interested in what has just been updated and a glimpse on what can be expected. --- antigen.zsh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/antigen.zsh b/antigen.zsh index 18ce4c4..16a8359 100644 --- a/antigen.zsh +++ b/antigen.zsh @@ -102,7 +102,7 @@ antigen-update () { | sort -u \ | while read url; do echo "**** Pulling $url" - -antigen-ensure-repo --update "$url" + -antigen-ensure-repo --update --verbose "$url" echo done } @@ -160,8 +160,15 @@ antigen-update () { if [[ ! -d $clone_dir ]]; then git clone "${url%|*}" "$clone_dir" elif $update; then + # Save current revision. + old_rev="$(git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \ + rev-parse HEAD)" # Pull changes if update requested. - git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" pull + git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \ + pull + # Get the new revision. + new_rev="$(git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \ + rev-parse HEAD)" fi # If its a specific branch that we want, checkout that branch. @@ -170,6 +177,14 @@ antigen-update () { checkout "${url#*|}" fi + if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then + echo Updated from ${old_rev:0:7} to ${new_rev:0:7}. + if $verbose; then + git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \ + log --oneline --reverse --no-merges --stat '@{1}..' + fi + fi + } -antigen-load () { -- 2.0.0