From 56c59ba4f4b13f122ef6adcabf93d3caedc3d3b5 Mon Sep 17 00:00:00 2001 From: Netkas Date: Thu, 13 Jul 2023 19:24:28 -0400 Subject: [PATCH] Updated `\ncc\Classes > GitClient > checkout()` to update submoudles. --- CHANGELOG.md | 1 + src/ncc/Classes/GitClient.php | 24 ++++++++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 68683e4..717000d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Refactored `\ncc\Objects > PackageLock` - Updated `defuse\php-encryption` to version 2.4.0 - Updated `\ncc\Classes > GitClient > cloneRepositor()` to clone submodules recursively by default + - Updated `\ncc\Classes > GitClient > checkout()` to update submoudles. ### Fixed - Fixed issue in `\ncc\Managers > ExecutionPointerManager > executeUnit()` where if ttyMode is enabled in a non-tty diff --git a/src/ncc/Classes/GitClient.php b/src/ncc/Classes/GitClient.php index a8cdd68..c1ece12 100644 --- a/src/ncc/Classes/GitClient.php +++ b/src/ncc/Classes/GitClient.php @@ -84,9 +84,33 @@ namespace ncc\Classes; }); if (!$process->isSuccessful()) + { throw new GitCheckoutException($process->getErrorOutput()); + } Console::outVerbose('Checked out branch: ' . $branch); + + Console::outVerbose('Updating submodules'); + $process = new Process(["git", "submodule", "update", "--init", "--recursive"], $path); + $process->setTimeout(3600); // 1 hour + $process->run(function ($type, $buffer) + { + if (Process::ERR === $type) + { + Console::outWarning($buffer); + } + else + { + Console::outVerbose($buffer); + } + }); + + if (!$process->isSuccessful()) + { + throw new GitCheckoutException($process->getErrorOutput()); + } + + Console::outVerbose('Submodules updated'); } /**