summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-02-11 10:16:25 +0100
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-02-11 10:16:25 +0100
commitbbb7b17811c4a991202ad246ab6073dd9a9e3de7 (patch)
tree8d7214ee88b18b350f46dd80f1f821adcc2b5962 /bin
parent961c53c18e31adde04acaa543d3d7226fef5c405 (diff)
bin/rbot: be compatible with older gits
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rbot23
1 files changed, 15 insertions, 8 deletions
diff --git a/bin/rbot b/bin/rbot
index b06c5745..382725c2 100755
--- a/bin/rbot
+++ b/bin/rbot
@@ -48,15 +48,22 @@ if $version =~ /svn/
git_out = `git status`
git_out.match(/^# On branch (.*)\n/)
- 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})"
+ 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
$version << " (#{branch} branch, #{rev})"
else