Add number of unpushed commits when pulling

This commit is contained in:
Adam Goldsmith 2023-09-08 13:42:47 -04:00
parent bc758f6e22
commit 8fa4fee06f
1 changed files with 10 additions and 2 deletions

12
dup
View File

@ -60,8 +60,16 @@ function do_pull_maybe_quiet() {
else
case "$first_line" in
"Already up to date.")
[[ "$quiet" == "true" ]] || \
pull_header_line "setaf 4" bold "$name" "$first_line"
unpushed_commits="$(git -C "$dir" rev-list @{upstream}..HEAD --count)"
if [[ "$quiet" != "true" ]]
then
if [[ "$unpushed_commits" == "0" ]]
then
pull_header_line "setaf 4" bold "$name" "Up to date"
else
pull_header_line "setaf 6" "setaf 6 bold" "$name" "Up to date, $unpushed_commits unpushed commits"
fi
fi
;;
Updating*)
if [[ "$quiet" != "true" ]]