From c906212c184990dc9e2c48b2499a8b6fab3362d8 Mon Sep 17 00:00:00 2001 From: Ben <908081+broesch@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:08:36 +0200 Subject: [PATCH] Fix issue with submodules and Base Directory --- app/Jobs/ApplicationDeploymentJob.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 9037fa3e5..8f4c328a0 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1492,9 +1492,25 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue ] ); $this->create_workdir(); + + $dirWithCommit = $this->workdir; + if ($this->application->settings->is_git_submodules_enabled && $this->basedir !== $this->workdir) { + $this->execute_remote_command( + [ + executeInDocker($this->deployment_uuid, "if git cat-file -e {$this->commit}^{commit} > /dev/null 2>&1;then echo 'No'; else echo 'Yes';fi"), + 'hidden' => true, + 'save' => 'workdir_is_submodule', + ] + ); + $this->application_deployment_queue->addLogEntry("Workdir is submodule: {$this->saved_outputs->get('workdir_is_submodule')}"); + if (trim($this->saved_outputs->get('workdir_is_submodule')) === 'Yes') { + $dirWithCommit = $this->basedir; + } + } + $this->execute_remote_command( [ - executeInDocker($this->deployment_uuid, "cd {$this->workdir} && git log -1 {$this->commit} --pretty=%B"), + executeInDocker($this->deployment_uuid, "cd {$dirWithCommit} && git log -1 {$this->commit} --pretty=%B"), 'hidden' => true, 'save' => 'commit_message', ]