forked from jakeonrails/git-notify
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 540ed48
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
#!/bin/bash | ||
|
||
# how we want to extract the variables from the commit message. | ||
format_name="--format=%cn" | ||
format_when="--format=%cd" | ||
format_summary="--format=%s" | ||
format_body="--format=%b" | ||
|
||
# what repository do we want to watch. | ||
repository="origin/master" | ||
latest_revision="none" | ||
|
||
# loop forever, need to kill the process. | ||
while [ 1 ]; do | ||
|
||
# get the latest revision SHA. | ||
current_revision=`git rev-parse $repository` | ||
|
||
# if we haven't seen that one yet, then we know there's new stuff. | ||
if [ $latest_revision != $current_revision ]; then | ||
|
||
# mark the newest revision as seen. | ||
latest_revision=$current_revision | ||
|
||
# extract the details from the log. | ||
commit_name=`git log -1 $format_name $latest_revision` | ||
commit_when=`git log -1 $format_when $latest_revision` | ||
commit_summary=`git log -1 $format_summary $latest_revision` | ||
commit_body=`git log -1 $format_body $latest_revision` | ||
|
||
# notify the user of the commit. | ||
summary="$commit_name committed to $repository $commit_when!" | ||
body="$commit_summary\n\n$commit_body" | ||
`notify-send "$summary" "$body"` | ||
|
||
fi | ||
sleep 60 | ||
done | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
git-notify | ||
======== | ||
|
||
Watches origin/master for new commits and notifies you. | ||
|
||
~/code/some-git-repository $ git-notify & | ||
|
||
The & on the end will make it run in the background instead of eating your terminal. | ||
|
||
Installation: | ||
------------ | ||
Just download git-notify and put it somewhere in your path. | ||
|
||
Jake Moffatt, jakeonrails@gmail.com | ||
|