From 0e37718319d3160fc78e869680f366baa83c8c2e Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 15:02:08 -0800 Subject: [PATCH 1/8] iterate post-update submodule inventory during state restoration --- lib/pug/Project.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lib/pug/Project.php b/lib/pug/Project.php index b1fdb57..2aec1e2 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 From 827153ba7db649d81c21ae2ac74111fa208c5dfa Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 15:28:27 -0800 Subject: [PATCH 2/8] updated CHANGELOG --- CHANGELOG.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 204494a..0ee3a50 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to Pug will be documented in this file (beginning with v0.5 😅). +## Unreleased +### Fixed +- Iterate through post-update submodule inventory during state restoration + ## [0.7.0] - 2017-11-14 ### Added - `pug install` From effdf4eaae1331044303777e79ee31d5c009f1af Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 15:29:00 -0800 Subject: [PATCH 3/8] bumped to v0.7.1 --- lib/config.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 From 8b52b0c4f59d7f01f88ff371be16bbaa7be9016c Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 16:20:20 -0800 Subject: [PATCH 4/8] switched to Directory::getPathname to prevent overwriting invalid paths (fixes #20) --- lib/pug/Project.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/pug/Project.php b/lib/pug/Project.php index b1fdb57..232a84e 100644 --- a/lib/pug/Project.php +++ b/lib/pug/Project.php @@ -463,7 +463,7 @@ public function jsonSerialize() { return [ 'name' => $this->getName(), - 'path' => $this->source->getRealPath(), + 'path' => $this->source->getPathname(), 'enabled' => $this->enabled, 'updated' => $this->updated ]; From 7ebaf45e522fd0c43c80eba4b0da168c5303ea46 Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 16:27:23 -0800 Subject: [PATCH 5/8] updated CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0ee3a50..d158068 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ All notable changes to Pug will be documented in this file (beginning with v0.5 ## Unreleased ### Fixed - Iterate through post-update submodule inventory during state restoration +- No longer overwrite invalid path with `false` ## [0.7.0] - 2017-11-14 ### Added From 4d624244768716985ae4e594964a1c9fabd385b1 Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 16:56:06 -0800 Subject: [PATCH 6/8] silently skip projects with file as path (fixes #23) --- lib/pug/Pug.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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 ); From be3f5fe2e531fbb893241e7fbe85f80b63c19216 Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 16:59:38 -0800 Subject: [PATCH 7/8] updated CHANGELOG --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index d158068..d21be24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to Pug will be documented in this file (beginning with v0.5 ### 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 From 7a00e73442e189456291e61c254da254123b4276 Mon Sep 17 00:00:00 2001 From: Ashur Cabrera Date: Mon, 14 Nov 2016 17:02:25 -0800 Subject: [PATCH 8/8] updated CHANGELOG --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d21be24..5685fb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,7 @@ All notable changes to Pug will be documented in this file (beginning with v0.5 😅). -## Unreleased +## [0.7.1] - 2017-11-14 ### Fixed - Iterate through post-update submodule inventory during state restoration - No longer overwrite invalid path with `false`