diff --git a/src/Composer/Installer.php b/src/Composer/Installer.php index d974f8c29..b4361a102 100644 --- a/src/Composer/Installer.php +++ b/src/Composer/Installer.php @@ -605,7 +605,14 @@ class Installer // output op if lock file is enabled, but alias op only in debug verbosity if ($this->config->get('lock') && (false === strpos($operation->getOperationType(), 'Alias') || $this->io->isDebug())) { - $this->io->writeError(' - ' . $operation->show(true)); + $sourceRepo = ''; + if ($this->io->isVeryVerbose() && false === strpos($operation->getOperationType(), 'Alias')) { + $operationPkg = ($operation instanceof UpdateOperation ? $operation->getTargetPackage() : $operation->getPackage()); + if ($operationPkg->getRepository() !== null) { + $sourceRepo = ' from ' . $operationPkg->getRepository()->getRepoName(); + } + } + $this->io->writeError(' - ' . $operation->show(true) . $sourceRepo); } } diff --git a/tests/Composer/Test/Command/UpdateCommandTest.php b/tests/Composer/Test/Command/UpdateCommandTest.php index cf84015e1..fce735087 100644 --- a/tests/Composer/Test/Command/UpdateCommandTest.php +++ b/tests/Composer/Test/Command/UpdateCommandTest.php @@ -29,7 +29,7 @@ class UpdateCommandTest extends TestCase $appTester = $this->getApplicationTester(); $appTester->run(array_merge(['command' => 'update', '--dry-run' => true, '--no-audit' => true], $command)); - $this->assertSame(trim($expected), trim($appTester->getDisplay(true))); + $this->assertStringMatchesFormat(trim($expected), trim($appTester->getDisplay(true))); } public static function provideUpdates(): \Generator @@ -67,6 +67,29 @@ Package operations: 2 installs, 0 updates, 0 removals OUTPUT ]; + yield 'simple update with very verbose output' => [ + $rootDepAndTransitiveDep, + ['-vv' => true], + << [ $rootDepAndTransitiveDep, ['--with' => ['dep/pkg:1.0.0'], '--no-install' => true],