From bbb7b17811c4a991202ad246ab6073dd9a9e3de7 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Mon, 11 Feb 2008 10:16:25 +0100 Subject: bin/rbot: be compatible with older gits --- bin/rbot | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) (limited to 'bin') 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 -- cgit v1.2.3