Added branch-alias for dev-master to ```--version|-V``` output when current
version is actually a revision (a non release/git tag). Example: Before: ``` $ composer --version Composer versionpull/3352/head73e9db5d99
2014-10-07 15:03:19 ``` After: ``` $ composer --version Composer version 1.0-dev (73e9db5d99
) 2014-10-07 15:03:19 ``` | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Doc PR | none
parent
73e9db5d99
commit
225a8f7a56
|
@ -12,6 +12,7 @@
|
|||
|
||||
namespace Composer;
|
||||
|
||||
use Composer\Json\JsonFile;
|
||||
use Symfony\Component\Finder\Finder;
|
||||
use Symfony\Component\Process\Process;
|
||||
|
||||
|
@ -44,6 +45,14 @@ class Compiler
|
|||
}
|
||||
$this->version = trim($process->getOutput());
|
||||
|
||||
$localConfig = __DIR__.'/../../composer.json';
|
||||
$file = new JsonFile($localConfig);
|
||||
$localConfig = $file->read();
|
||||
|
||||
if (isset($localConfig['extra']['branch-alias']['dev-master'])) {
|
||||
$this->version = sprintf('%s (%s)', $localConfig['extra']['branch-alias']['dev-master'], $this->version);
|
||||
}
|
||||
|
||||
$process = new Process('git log -n1 --pretty=%ci HEAD', __DIR__);
|
||||
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.');
|
||||
|
|
Loading…
Reference in New Issue