1
0
Fork 0

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 version 73e9db5d99 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
pull/3352/head
Javier Spagnoletti 2014-10-13 16:17:28 -03:00
parent 73e9db5d99
commit 225a8f7a56
1 changed files with 9 additions and 0 deletions

View File

@ -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.');