Created
July 20, 2012 01:51
-
-
Save tyrone-sudeium/3148171 to your computer and use it in GitHub Desktop.
Push to Git and Notify Skype
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 | |
REMOTE="origin" | |
if [ $# -gt 0 ] | |
then | |
REMOTE="$1" | |
fi | |
BRANCH=$(git symbolic-ref -q HEAD) | |
BRANCH=${BRANCH##refs/heads/} | |
BRANCH=${BRANCH:-HEAD} | |
CONFIGFILE=$(git rev-parse --show-toplevel)/.gitskype | |
#echo $BRANCH | |
git status > /dev/null | |
if [ $? -ne 0 ] | |
then | |
echo "fatal: not a git repository" | |
fi | |
SKYPECHATID=`git config --file $CONFIGFILE skype.chatid` | |
if [ $? -ne 0 ] | |
then | |
echo "fatal: please add skype.chatid to your git config" | |
exit 1 | |
fi | |
REPOMESSAGE=" " | |
REPONAME=`git config --file $CONFIGFILE skype.reponame` | |
if [ $? -eq 0 ]; then | |
REPOMESSAGE=" for repository '$REPONAME' " | |
fi | |
GIT=`git log --branches="*$BRANCH" --not --remotes --oneline` | |
if [ -n "$GIT" ]; then | |
MSG="git push${REPOMESSAGE}to $REMOTE from $BRANCH with commits:\n$GIT" | |
else | |
MSG="git push${REPOMESSAGE}to $REMOTE from $BRANCH with no code-changing commits." | |
fi | |
#git diff --stat $REMOTE | grep pbxproj > /dev/null | |
#if [ $? -eq 0 ]; then | |
# MSG="PROJECT CHANGING $MSG" | |
#fi | |
git push $REMOTE $BRANCH || exit $? | |
COMMANDSTRING="CHATMESSAGE $SKYPECHATID $MSG" | |
osascript -e "tell application \"Skype\"" \ | |
-e "send command \"$COMMANDSTRING\" script name \"Commit Script\"" \ | |
-e "end tell" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hey there!
Where can I find
skype.chatid
?Thanks!