#!/bin/sh
# Check for new commits in remote

# Git folders to check for new commits
set -- $HOME/Documents $HOME/.config
total=0

for repo in $@ ; do
    git -C "$repo" remote update > /dev/null 2>&1
    commits=$(git -C "$repo" status | grep -o "[0-9*]\scommit" | cut -d " " -f 1)
    [ -n "$commits" ] && total=$(($total+$commits))
done

[ "$total" = 0 ] && exit

echo "$total"
kill -54 "$(pidof dwmblocks)"