Skip to content

Commit

Permalink
add name-rev trying to retrieve a nice version
Browse files Browse the repository at this point in the history
This will render tag names rather than commit hashes in deps.lock file, where possible.
  • Loading branch information
havvg committed Jan 9, 2012
1 parent c32d447 commit dc62f29
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion bin/vendors
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,19 @@ foreach ($deps as $name => $dep) {
if ('update' === $command || 'lock' === $command) {
ob_start();
system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
$newversions[] = trim($name.' '.ob_get_clean());
$newversion = trim(ob_get_clean());

ob_start();
system(sprintf('cd %s && git name-rev --tags --name-only %s', escapeshellarg($installDir), $newversion));
// remove trailing ^0 from tags, those are the tags themselves
$niceversion = preg_replace('/\^0$/', '', trim(ob_get_clean()));

// undefined is returned in case no name-rev could be found
if ('undefined' !== $niceversion) {
$newversions[] = $name.' '.$niceversion;
} else {
$newversions[] = $name.' '.$newversion;
}
}
}

Expand Down

0 comments on commit dc62f29

Please sign in to comment.