summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rbot39
1 files changed, 22 insertions, 17 deletions
diff --git a/bin/rbot b/bin/rbot
index a5b7865a..ed6b57f8 100755
--- a/bin/rbot
+++ b/bin/rbot
@@ -68,24 +68,29 @@ $opts = Hash.new
if $version =~ /git/
if defined?(SCM_DIR) and File.exists?(File.join(SCM_DIR, '.git'))
- git_out = `git status`
-
- git_out.match(/^# On branch (.*)\n/)
- if $1 # git 1.5.x
- branch = $1.dup || "unknown"
- changed = git_out.match(/^# Change(.*)\n/)
- rev = "revision "
- git_out = `git log -1 --pretty=format:"%h%n%b"`.split("\n")
- rev << git_out.first
- if git_out.last.match(/^git-svn-id: \S+@(\d+)/)
- rev << "(svn #{$1})"
+ begin
+ git_out = `git status`
+ git_out.match(/^# On branch (.*)\n/)
+ if $1 # git 1.5.x
+ branch = $1.dup || "unknown"
+ changed = git_out.match(/^# Change(.*)\n/)
+ rev = "revision "
+ git_out = `git log -1 --pretty=format:"%h%n%b"`.split("\n")
+ rev << git_out.first
+ if git_out.last.match(/^git-svn-id: \S+@(\d+)/)
+ rev << "(svn #{$1})"
+ end
+ rev << ", local changes" if changed
+ else # older gits
+ git_out = `git branch`
+ git_out.match(/^\* (.*)\n/)
+ branch = $1.dup rescue "unknown"
+ rev = "revision " + `git rev-parse HEAD`[0,6]
end
- rev << ", local changes" if changed
- else # older gits
- git_out = `git branch`
- git_out.match(/^\* (.*)\n/)
- branch = $1.dup rescue "unknown"
- rev = "revision " + `git rev-parse HEAD`[0,6]
+ rescue => e
+ puts e.inspect
+ branch = "unknown branch"
+ rev = "unknown revision"
end
$version << " (#{branch} branch, #{rev})"