Skip to content

Commit

Permalink
Merge pull request #60 from NotNite/submodules
Browse files Browse the repository at this point in the history
Handle recursive submodules (closes #51)
  • Loading branch information
philpax authored Mar 21, 2024
2 parents 23077bb + 74f3017 commit a595d84
Showing 1 changed file with 16 additions and 8 deletions.
24 changes: 16 additions & 8 deletions Plogon/BuildProcessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -812,14 +812,7 @@ public async Task<BuildResult> ProcessTask(BuildTask task, bool commit, string?
{
}, null);
repo.Reset(ResetMode.Hard, task.Manifest.Plugin.Commit);

foreach (var submodule in repo.Submodules)
{
repo.Submodules.Update(submodule.Name, new SubmoduleUpdateOptions
{
Init = true,
});
}
HandleSubmodules(repo);

if (!await CheckIfTrueCommit(work, task.Manifest.Plugin.Commit))
throw new Exception("Commit in manifest is not a true commit, please don't specify tags");
Expand Down Expand Up @@ -1157,6 +1150,21 @@ private static void CopySourceForArchive(DirectoryInfo from, DirectoryInfo to, i
}
}

private static void HandleSubmodules(Repository repo)
{
foreach (var submodule in repo.Submodules)
{
repo.Submodules.Update(submodule.Name, new SubmoduleUpdateOptions
{
Init = true,
});

// In the case of recursive submodules
var submoduleRepo = new Repository(Path.Combine(repo.Info.WorkingDirectory, submodule.Path));
HandleSubmodules(submoduleRepo);
}
}

/// <summary>
/// Exception when repo commit fails
/// </summary>
Expand Down

0 comments on commit a595d84

Please sign in to comment.