diff options
author | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-11 10:16:25 +0100 |
---|---|---|
committer | Giuseppe Bilotta <giuseppe.bilotta@gmail.com> | 2008-02-11 10:16:25 +0100 |
commit | bbb7b17811c4a991202ad246ab6073dd9a9e3de7 (patch) | |
tree | 8d7214ee88b18b350f46dd80f1f821adcc2b5962 /bin | |
parent | 961c53c18e31adde04acaa543d3d7226fef5c405 (diff) |
bin/rbot: be compatible with older gits
Diffstat (limited to 'bin')
-rwxr-xr-x | bin/rbot | 23 |
1 files changed, 15 insertions, 8 deletions
@@ -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 |