Improve pull output, inspired by zimfw update

This commit is contained in:
Adam Goldsmith 2023-04-15 21:47:21 -04:00
parent 97b399681e
commit 51362d8c81

11
dup
View File

@ -48,10 +48,15 @@ function do_pull_maybe_quiet() {
name="$1" name="$1"
dir="${2:-$name}" dir="${2:-$name}"
git_out="$(do_pull $dir)" git_out="$(do_pull $dir)"
if [[ "$quiet" != true || "$git_out" != "Already up to date." ]] first_line="${git_out%%$'\n'*}"
if [[ "$quiet" != true || "$first_line" != "Already up to date." ]]
then then
echo "Updating $name" echo "$(tput setaf 4)}$(tput sgr0) $(tput bold)$name$(tput sgr0): $first_line"
echo "$git_out" fi
if [[ $first_line == Updating* ]]
then
git -C "${dir}" log --graph --color --format='%C(yellow)%h%C(reset) %s %C(cyan)(%cr)%C(reset)' ${first_line##Updating } \
| sed 's/^/ /'
fi fi
} }