Add SubModule Support

This commit is contained in:
Canon
2026-02-08 16:49:47 +08:00
parent d45033d998
commit 62ebaa88a7
2 changed files with 10 additions and 5 deletions
+8 -4
View File
@@ -109,7 +109,7 @@ public partial class GitService : IGitService
CancellationToken ct = default) CancellationToken ct = default)
{ {
progress?.Report("Fetching from remote..."); progress?.Report("Fetching from remote...");
var (exitCode, _, error) = await RunGitCommandAsync(path, "fetch --all --prune", ct); var (exitCode, _, error) = await RunGitCommandAsync(path, "fetch --all --prune --recurse-submodules", ct);
if (exitCode != 0) if (exitCode != 0)
progress?.Report($"Fetch failed: {error}"); progress?.Report($"Fetch failed: {error}");
@@ -121,7 +121,7 @@ public partial class GitService : IGitService
CancellationToken ct = default) CancellationToken ct = default)
{ {
progress?.Report("Pulling changes..."); progress?.Report("Pulling changes...");
var (exitCode, _, error) = await RunGitCommandAsync(path, "pull --ff-only", ct); var (exitCode, _, error) = await RunGitCommandAsync(path, "pull --ff-only --recurse-submodules", ct);
if (exitCode != 0) if (exitCode != 0)
progress?.Report($"Pull failed: {error}"); progress?.Report($"Pull failed: {error}");
@@ -139,7 +139,7 @@ public partial class GitService : IGitService
var (exitCode, error) = await RunGitCommandWithProgressAsync( var (exitCode, error) = await RunGitCommandWithProgressAsync(
parentDir, parentDir,
$"clone --progress \"{url}\" \"{folderName}\"", $"clone --progress --recurse-submodules \"{url}\" \"{folderName}\"",
percentProgress, percentProgress,
ct, ct,
timeoutMs: 300000); // 5 minute timeout for clone timeoutMs: 300000); // 5 minute timeout for clone
@@ -167,7 +167,11 @@ public partial class GitService : IGitService
public async Task<bool> CheckoutAsync(string path, string branchOrCommit, CancellationToken ct = default) public async Task<bool> CheckoutAsync(string path, string branchOrCommit, CancellationToken ct = default)
{ {
var (exitCode, _, _) = await RunGitCommandAsync(path, $"checkout \"{branchOrCommit}\"", ct); var (exitCode, _, _) = await RunGitCommandAsync(path, $"checkout \"{branchOrCommit}\"", ct);
return exitCode == 0; if (exitCode != 0)
return false;
await RunGitCommandAsync(path, "submodule update --init --recursive", ct);
return true;
} }
public async Task<bool> HasLocalChangesAsync(string path, CancellationToken ct = default) public async Task<bool> HasLocalChangesAsync(string path, CancellationToken ct = default)
+2 -1
View File
@@ -29,6 +29,7 @@
"Spectre.Console": "0.53.1" "Spectre.Console": "0.53.1"
} }
} }
} },
"net10.0/linux-x64": {}
} }
} }