Skip to content
This repository was archived by the owner on Nov 27, 2020. It is now read-only.

Commit dc62f29

Browse files
committed
add name-rev trying to retrieve a nice version
This will render tag names rather than commit hashes in deps.lock file, where possible.
1 parent c32d447 commit dc62f29

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

bin/vendors

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,19 @@ foreach ($deps as $name => $dep) {
118118
if ('update' === $command || 'lock' === $command) {
119119
ob_start();
120120
system(sprintf('cd %s && git log -n 1 --format=%%H', escapeshellarg($installDir)));
121-
$newversions[] = trim($name.' '.ob_get_clean());
121+
$newversion = trim(ob_get_clean());
122+
123+
ob_start();
124+
system(sprintf('cd %s && git name-rev --tags --name-only %s', escapeshellarg($installDir), $newversion));
125+
// remove trailing ^0 from tags, those are the tags themselves
126+
$niceversion = preg_replace('/\^0$/', '', trim(ob_get_clean()));
127+
128+
// undefined is returned in case no name-rev could be found
129+
if ('undefined' !== $niceversion) {
130+
$newversions[] = $name.' '.$niceversion;
131+
} else {
132+
$newversions[] = $name.' '.$newversion;
133+
}
122134
}
123135
}
124136

0 commit comments

Comments
 (0)