summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-27 01:41:30 +0000
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2007-08-27 01:41:30 +0000
commit36b1426d7235344b4b33567de29b767ae2882276 (patch)
tree02e3e4fcd547ad2c5cfe7c583364739792a28fc4
parent634f2c36033e59883eb1ef11aafa73c339c4c4ba (diff)
When running from a git repository, expose the current git revision
-rwxr-xr-xbin/rbot11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/rbot b/bin/rbot
index c6d62daa..94634458 100755
--- a/bin/rbot
+++ b/bin/rbot
@@ -44,6 +44,17 @@ $opts = Hash.new
if $version =~ /svn/
if defined?(SVN_DIR) and File.exists?(File.join(SVN_DIR, '.git'))
$version.sub!('svn', 'git')
+
+ git_out = `git status`
+
+ git_out.match(/^# On branch (.*)\n/)
+ branch = $1
+ changed = git_out.match(/^# Change(.*)\n/)
+ rev = " @ #{`git rev-parse HEAD`[0..6]}"
+ rev << ", local changes" if changed
+
+ $version << "-#{branch}" unless branch.empty?
+ $version << rev
else
up = File.dirname(__FILE__) + "/.."
rev = " (unknown revision)"