From 8daf424f49f8b754354f72dbe650d64cd6e7cbbd Mon Sep 17 00:00:00 2001 From: Daniel James Date: Wed, 3 Jun 2015 23:20:19 +0100 Subject: [PATCH] Fix currentHashes for empty $paths. --- src/LocalMirror.php | 4 ++-- src/SuperProject.php | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/LocalMirror.php b/src/LocalMirror.php index a6a41fd..e2972a2 100644 --- a/src/LocalMirror.php +++ b/src/LocalMirror.php @@ -126,8 +126,8 @@ class LocalMirror { $child_repos = []; foreach(SuperProject::readSubmoduleConfig($dst_dir) as $name => $values) { - if (empty($values['path']) { throw \RuntimeException("Missing path."); - if (empty($values['url']) { throw \RuntimeException("Missing URL."); + if (empty($values['path'])) { throw \RuntimeException("Missing path."); } + if (empty($values['url'])) { throw \RuntimeException("Missing URL."); } $child_repos[$values['path']] = self::resolveGithubUrl($values['url'], $repo); } diff --git a/src/SuperProject.php b/src/SuperProject.php index 89c2779..6653166 100644 --- a/src/SuperProject.php +++ b/src/SuperProject.php @@ -176,8 +176,10 @@ class SuperProject extends Repo { * @return Array */ static function currentHashes($repo_path, $paths, $ref = 'HEAD') { - $matches = null; $hashes = Array(); + if (!$paths) { return $hashes; } + + $matches = null; foreach (Process::read_lines( "git ls-tree {$ref} ". implode(' ', $paths), $repo_path) as $line)