From 5a473439ed28bdf7ce397d607fa99cb2df9d80c3 Mon Sep 17 00:00:00 2001 From: Javier Spagnoletti Date: Fri, 17 Oct 2014 15:07:26 -0300 Subject: [PATCH] Updated $branchAliasVersion set based on @Seldaek's suggestion. --- src/Composer/Compiler.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/Composer/Compiler.php b/src/Composer/Compiler.php index 20989cf94..b1b3725c6 100644 --- a/src/Composer/Compiler.php +++ b/src/Composer/Compiler.php @@ -50,13 +50,7 @@ class Compiler if ($process->run() != 0) { 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.'); } - $localConfig = __DIR__.'/../../composer.json'; - $file = new JsonFile($localConfig); - $localConfig = $file->read(); - if (isset($localConfig['extra']['branch-alias']['dev-master'])) { - $this->branchAliasVersion = $localConfig['extra']['branch-alias']['dev-master']; - } $date = new \DateTime(trim($process->getOutput())); $date->setTimezone(new \DateTimeZone('UTC')); $this->versionDate = $date->format('Y-m-d H:i:s'); @@ -64,6 +58,14 @@ class Compiler $process = new Process('git describe --tags HEAD'); if ($process->run() == 0) { $this->version = trim($process->getOutput()); + } else { + // get branch-alias defined in composer.json for dev-master (if any) + $localConfig = __DIR__.'/../../composer.json'; + $file = new JsonFile($localConfig); + $localConfig = $file->read(); + if (isset($localConfig['extra']['branch-alias']['dev-master'])) { + $this->branchAliasVersion = $localConfig['extra']['branch-alias']['dev-master']; + } } $phar = new \Phar($pharFile, 0, 'composer.phar');