Skip to content
Browse files

add name-rev trying to retrieve a nice version

This will render tag names rather than commit hashes in deps.lock file, where possible.
  • Loading branch information...
1 parent c32d447 commit dc62f29c74094f4a76262f9b902c5bba814c62b4 @havvg committed Jan 9, 2012
Showing with 13 additions and 1 deletion.
  1. +13 −1 bin/vendors
View
14 bin/vendors
@@ -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;
+ }
}
}

0 comments on commit dc62f29

Please sign in to comment.
Something went wrong with that request. Please try again.