From 758e7cab53abc579168345bca9e94652a0a6a810 Mon Sep 17 00:00:00 2001 From: Steve Buzonas Date: Thu, 12 May 2016 21:35:25 -0400 Subject: [PATCH] fixed issue where detatched head would give null output --- src/Composer/Command/StatusCommand.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/StatusCommand.php b/src/Composer/Command/StatusCommand.php index 506fdbb5e..b946355c4 100644 --- a/src/Composer/Command/StatusCommand.php +++ b/src/Composer/Command/StatusCommand.php @@ -175,10 +175,12 @@ EOT foreach ($vcsVersionChanges as $path => $changes) { if ($input->getOption('verbose')) { - $currentVersion = $changes['current']['version']; - $previousVersion = $changes['previous']['version']; + // If we don't can't find a version, use the ref instead. + $currentVersion = $changes['current']['version'] ?: $changes['current']['ref']; + $previousVersion = $changes['previous']['version'] ?: $changes['previous']['ref']; if ($io->isVeryVerbose()) { + // Output the ref regardless of whether or not it's being used as the version $currentVersion .= sprintf(' (%s)', $changes['current']['ref']); $previousVersion .= sprintf(' (%s)', $changes['previous']['ref']); }