- # determine the real version number
- $gitbranch = 'none';
- $gitversion = 'none';
- my $repo = Git->repository(Directory => "$root/.git");
- if ($repo) {
- my $desc = $repo->command_oneline(['describe'], STDERR => 0);
- if ($desc) {
- my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/;
- $version = $v;
- $subversion = $s || 0;
- $build = $b || 0;
- $gitversion = "$g\[r]";
+ eval {@branch = `git --git-dir=$root/.git branch`};
+ unless ($@) {
+ for (@branch) {
+ my ($star, $b) = split /\s+/;
+ if ($star eq '*') {
+ $gitbranch = $b;
+ last;
+ }