1
0
Fork 0

Ensure we run git commands for bin/compile inside the root of the git repo, refs #12194

pull/12205/head
Jordi Boggiano 2024-11-15 14:08:32 +01:00
parent 2e83ead40c
commit 580f0006d6
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -51,19 +51,19 @@ class Compiler
$process = new ProcessExecutor();
if (0 !== $process->execute(['git', 'log', '--pretty=%H', '-n1', 'HEAD'], $output, __DIR__)) {
if (0 !== $process->execute(['git', 'log', '--pretty=%H', '-n1', 'HEAD'], $output, dirname(dirname(__DIR__)))) {
throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');
}
$this->version = trim($output);
if (0 !== $process->execute(['git', 'log', '-n1', '--pretty=%ci', 'HEAD'], $output, __DIR__)) {
if (0 !== $process->execute(['git', 'log', '-n1', '--pretty=%ci', 'HEAD'], $output, dirname(dirname(__DIR__)))) {
throw new \RuntimeException('Can\'t run git log. You must ensure to run compile from composer git repository clone and that git binary is available.');
}
$this->versionDate = new \DateTime(trim($output));
$this->versionDate->setTimezone(new \DateTimeZone('UTC'));
if (0 === $process->execute(['git', 'describe', '--tags', '--exact-match', 'HEAD'], $output, __DIR__)) {
if (0 === $process->execute(['git', 'describe', '--tags', '--exact-match', 'HEAD'], $output, dirname(dirname(__DIR__)))) {
$this->version = trim($output);
} else {
// get branch-alias defined in composer.json for dev-main (if any)