|
|
@@ -50,13 +50,12 @@ class git
|
|
|
$cmd = 'git ls-remote origin "refs/heads/' . $_target . '"';
|
|
|
$output = [];
|
|
|
$retval = 0;
|
|
|
- $result = exec($cmd, $output, $retval);
|
|
|
- // $result ou $output[0] = "<hash>\trefs/heads/branch"
|
|
|
- $hash = '';
|
|
|
- if (!empty($output) && strpos($output[0], '\t') !== false) {
|
|
|
- $hash = explode("\t", $output[0])[0];
|
|
|
+ exec($cmd, $output, $retval);
|
|
|
+ if (isset($output[0]) && preg_match('/^([a-f0-9]{40})/', $output[0], $matches)) {
|
|
|
+ return substr($matches[1], 0, 10);
|
|
|
+ } else {
|
|
|
+ return "<pre>DISTANT ($_target): N/A</pre>";
|
|
|
}
|
|
|
- return substr(trim($hash), 0, 10);
|
|
|
}
|
|
|
}
|
|
|
|