- # determine the real version number
- my $repo = Git->repository(Directory => "$root/.git");
- if ($repo) {
- my $desc = $repo->command_oneline(['describe', '--long'], STDERR => 0);
- if ($desc) {
- my ($v, $s, $b, $g) = $desc =~ /^([\d.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/;
- $s ||= '';
- dbg("Git: $desc") if isdbg('git');
- dbg("Git: V=$v S=$s B=$b g=$g") if isdbg('git');
- $version = $v;
- $build = $b || 0;
- $gitversion = "$g\[r]";
- }
- my @branch = $repo->command([qw{branch}], STDERR=>0);
+ # determine the real Git build number and branch
+ my $desc;
+ eval {$desc = `git --git-dir=$root/.git describe --long`};
+ if (!$@ && $desc) {
+ my ($v, $s, $b, $g) = $desc =~ /^([\d\.]+)(?:\.(\d+))?-(\d+)-g([0-9a-f]+)/;
+ $version = $v;
+ my $subversion = $s || 0; # not used elsewhere
+ $build = $b || 0;
+ $gitversion = "$g\[r]";
+ }
+ if (!$@) {
+ my @branch;
+
+ eval {@branch = `git --git-dir=$root/.git branch`};
+ unless ($@) {