Created
September 28, 2011 10:19
-
-
Save ku1ik/1247581 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
## MOVED TO https://github.com/sickill/git-dude | |
INTERVAL=30 | |
ICON_PATH=`pwd`/icon.png | |
export LC_ALL=C # make sure git talks english | |
while [ 1 ]; do | |
for dir_name in *; do | |
if [[ -d $dir_name ]]; then | |
repo_name=$(basename $dir_name .git) | |
cd $dir_name | |
CHANGES=$(git fetch -v 2>&1 | grep -F -- '->') | |
while read -r line; do | |
case $line in | |
*..*) | |
commit_range=$(echo "$line" | awk '{ print $1 }') | |
branch_name=$(echo "$line" | awk '{ print $2 }') | |
commit_messages=$(git log $commit_range --pretty=format:'%s (%an)') | |
notify-send -i $ICON_PATH "New commits in $repo_name/$branch_name" "$commit_messages" | |
;; | |
*new*) | |
branch_name=$(echo "$line" | awk '{ print $4 }') | |
notify-send -i $ICON_PATH "New branch $repo_name/$branch_name" | |
;; | |
esac | |
done <<< "$CHANGES" | |
cd - &>/dev/null | |
fi | |
done | |
sleep $INTERVAL | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment