@@ -37,6 +37,7 @@ class UpdateRecipesCommand extends BaseCommand
3737 private $ configurator ;
3838 private $ rootDir ;
3939 private $ githubApi ;
40+ private $ processExecutor ;
4041
4142 public function __construct (/* cannot be type-hinted */ $ flex , Downloader $ downloader , $ httpDownloader , Configurator $ configurator , string $ rootDir )
4243 {
@@ -166,6 +167,10 @@ protected function execute(InputInterface $input, OutputInterface $output): int
166167 $ symfonyLock ->add ($ packageName , $ newRecipe ->getLock ());
167168 $ this ->flex ->finish ($ this ->rootDir , $ originalComposerJsonHash );
168169
170+ // stage symfony.lock, as all patched files with already be staged
171+ $ cmdOutput = '' ;
172+ $ this ->getProcessExecutor ()->execute ('git add symfony.lock ' , $ cmdOutput , $ this ->rootDir );
173+
169174 $ io ->write ([
170175 ' <bg=blue;fg=white> </> ' ,
171176 ' <bg=blue;fg=white> Yes! Recipe updated! </> ' ,
@@ -392,14 +397,22 @@ private function askForPackage(IOInterface $io, Lock $symfonyLock): ?string
392397
393398 private function isIndexClean (IOInterface $ io ): bool
394399 {
395- $ processExecutor = new ProcessExecutor ($ io );
396400 $ output = '' ;
397401
398- $ processExecutor ->execute ('git status --porcelain --untracked-files=no ' , $ output , $ this ->rootDir );
402+ $ this -> getProcessExecutor () ->execute ('git status --porcelain --untracked-files=no ' , $ output , $ this ->rootDir );
399403 if ('' !== trim ($ output )) {
400404 return false ;
401405 }
402406
403407 return true ;
404408 }
409+
410+ private function getProcessExecutor (): ProcessExecutor
411+ {
412+ if (null === $ this ->processExecutor ) {
413+ $ this ->processExecutor = new ProcessExecutor ($ this ->getIO ());
414+ }
415+
416+ return $ this ->processExecutor ;
417+ }
405418}
0 commit comments