Commit 0912ba47242d8d83a90aa774a5ab2836f8b28d21

Authored by Shrikant Sharat
1 parent c1479baff8

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.

Showing 1 changed file with 17 additions and 2 deletions Side-by-side Diff

... ... @@ -102,7 +102,7 @@ antigen-update () {
102 102 | sort -u \
103 103 | while read url; do
104 104 echo "**** Pulling $url"
105   - -antigen-ensure-repo --update "$url"
  105 + -antigen-ensure-repo --update --verbose "$url"
106 106 echo
107 107 done
108 108 }
... ... @@ -160,8 +160,15 @@ antigen-update () {
160 160 if [[ ! -d $clone_dir ]]; then
161 161 git clone "${url%|*}" "$clone_dir"
162 162 elif $update; then
  163 + # Save current revision.
  164 + old_rev="$(git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \
  165 + rev-parse HEAD)"
163 166 # Pull changes if update requested.
164   - git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" pull
  167 + git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \
  168 + pull
  169 + # Get the new revision.
  170 + new_rev="$(git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \
  171 + rev-parse HEAD)"
165 172 fi
166 173  
167 174 # If its a specific branch that we want, checkout that branch.
... ... @@ -170,6 +177,14 @@ antigen-update () {
170 177 checkout "${url#*|}"
171 178 fi
172 179  
  180 + if ! [[ -z $old_rev || $old_rev == $new_rev ]]; then
  181 + echo Updated from ${old_rev:0:7} to ${new_rev:0:7}.
  182 + if $verbose; then
  183 + git --git-dir "$clone_dir/.git" --work-tree "$clone_dir" \
  184 + log --oneline --reverse --no-merges --stat '@{1}..'
  185 + fi
  186 + fi
  187 +
173 188 }
174 189  
175 190 -antigen-load () {