Skip to content

Commit baff327

Browse files
author
David Castro
authored
Merge pull request #104 from moodleworkplace/clean_up_submodules
Clean up submodules
2 parents c88d592 + ec38a49 commit baff327

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/Installer/MoodleInstaller.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,14 @@ public function install()
9191
// Expand the path to Moodle so all other installers use absolute path.
9292
$this->moodle->directory = $this->expandPath($this->moodle->directory);
9393

94+
// If there are submodules, we clean up empty directories, since we
95+
// don't initialise them properly anyway.
96+
if (is_file($this->moodle->directory.'/.gitmodules')) {
97+
$process = new Process(sprintf('git config -f %s --get-regexp \'^submodule\..*\.path$\' | awk \'{ print $2 }\' | xargs -i rmdir "%s/{}"', $this->moodle->directory.'/.gitmodules', $this->moodle->directory));
98+
$process->setTimeout(null);
99+
$this->execute->mustRun($process);
100+
}
101+
94102
$this->getOutput()->step('Moodle assets');
95103

96104
$this->getOutput()->debug('Creating Moodle data directories');

0 commit comments

Comments
 (0)