|
@@ -39,15 +39,15 @@ class git
|
|
|
public static function getCommitHash($_target = NULL)
|
|
public static function getCommitHash($_target = NULL)
|
|
|
{
|
|
{
|
|
|
if ($_target == NULL) {
|
|
if ($_target == NULL) {
|
|
|
- $target = "HEAD";
|
|
|
|
|
|
|
+ // Commit local HEAD
|
|
|
|
|
+ $cmd = 'git log --pretty="%H" -n1 HEAD';
|
|
|
} else {
|
|
} else {
|
|
|
- $target = "origin/" . $_target;
|
|
|
|
|
|
|
+ // On met à jour les refs distantes avant de lire origin/$_target
|
|
|
|
|
+ exec('git fetch --all --prune');
|
|
|
|
|
+ $cmd = 'git log --pretty="%H" -n1 origin/' . $_target;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- exec('git fetch --all --prune');
|
|
|
|
|
$output = [];
|
|
$output = [];
|
|
|
$retval = 0;
|
|
$retval = 0;
|
|
|
- $cmd = 'git log --pretty="%H" -n1 ' . $target;
|
|
|
|
|
$result = exec($cmd, $output, $retval);
|
|
$result = exec($cmd, $output, $retval);
|
|
|
return substr(trim($result), 0, 10);
|
|
return substr(trim($result), 0, 10);
|
|
|
}
|
|
}
|