diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-27 01:41:30 +0000 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2007-08-27 01:41:30 +0000 |
commit | 36b1426d7235344b4b33567de29b767ae2882276 (patch) | |
tree | 02e3e4fcd547ad2c5cfe7c583364739792a28fc4 /bin | |
parent | 634f2c36033e59883eb1ef11aafa73c339c4c4ba (diff) |
When running from a git repository, expose the current git revision
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rbot | 11 |
1 files changed, 11 insertions, 0 deletions
@@ -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)" |