diff --git a/CHANGELOG.md b/CHANGELOG.md index 204494a..5685fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to Pug will be documented in this file (beginning with v0.5 😅). +## [0.7.1] - 2017-11-14 +### Fixed +- Iterate through post-update submodule inventory during state restoration +- No longer overwrite invalid path with `false` +- Silently skip projects with file as path + ## [0.7.0] - 2017-11-14 ### Added - `pug install` diff --git a/lib/config.php b/lib/config.php index ac796f3..837c8b9 100644 --- a/lib/config.php +++ b/lib/config.php @@ -9,7 +9,7 @@ /* * Application version */ - 'version' => '0.7.0', + 'version' => '0.7.1', /* * PHP minimum version diff --git a/lib/pug/Project.php b/lib/pug/Project.php index b1fdb57..d2e47bf 100644 --- a/lib/pug/Project.php +++ b/lib/pug/Project.php @@ -408,15 +408,20 @@ public function updateSubmodules( array $preInventory ) /* * Restore submodules to previous states as appropriate */ - foreach( $preInventory as $submoduleName => $preUpdateInfo ) + foreach( $postInventory as $submoduleName => $postUpdateInfo ) { - $projectSubmodule = $preUpdateInfo['project']; + $projectSubmodule = $postUpdateInfo['project']; $pathSubmodule = $projectSubmodule->getPath(); $stringFormatted = new Format\String(); $stringFormatted->foregroundColor( 'blue' ); - $postUpdateInfo = $postInventory[$submoduleName]; + if( !isset( $preInventory[$submoduleName] ) ) + { + continue; + } + + $preUpdateInfo = $preInventory[$submoduleName]; /* * Submodules that were checked out to a branch before the update @@ -463,7 +468,7 @@ public function jsonSerialize() { return [ 'name' => $this->getName(), - 'path' => $this->source->getRealPath(), + 'path' => $this->source->getPathname(), 'enabled' => $this->enabled, 'updated' => $this->updated ]; diff --git a/lib/pug/Pug.php b/lib/pug/Pug.php index 43a92e2..414616b 100644 --- a/lib/pug/Pug.php +++ b/lib/pug/Pug.php @@ -63,7 +63,15 @@ public function __construct() { $enabled = isset( $projectInfo['enabled'] ) ? $projectInfo['enabled'] : true; $updated = isset( $projectInfo['updated'] ) ? $projectInfo['updated'] : null; - $dirProject = new File\Directory( $projectInfo['path'] ); + + try + { + $dirProject = new File\Directory( $projectInfo['path'] ); + } + catch( \Exception $e ) + { + continue; + } $project = new Project( $projectInfo['name'], $dirProject, $enabled, $updated );