From 1e22a60661c914067cc554817a60e415e1e16b6f Mon Sep 17 00:00:00 2001 From: "NullDev (Shadow)" Date: Mon, 18 Nov 2024 17:06:38 +0100 Subject: [PATCH] [fix/fluxgym-update] pull sd-scripts instead of clone if folder exists --- .../Models/Packages/FluxGym.cs | 26 +++++++++++++------ 1 file changed, 18 insertions(+), 8 deletions(-) diff --git a/StabilityMatrix.Core/Models/Packages/FluxGym.cs b/StabilityMatrix.Core/Models/Packages/FluxGym.cs index aa1771f1..59bc34cf 100644 --- a/StabilityMatrix.Core/Models/Packages/FluxGym.cs +++ b/StabilityMatrix.Core/Models/Packages/FluxGym.cs @@ -85,14 +85,24 @@ public override async Task InstallPackage( CancellationToken cancellationToken = default ) { - progress?.Report(new ProgressReport(-1f, "Cloning sd-scripts", isIndeterminate: true)); - await prerequisiteHelper - .RunGit( - ["clone", "-b", "sd3", "https://github.com/kohya-ss/sd-scripts"], - onConsoleOutput, - installLocation - ) - .ConfigureAwait(false); + progress?.Report(new ProgressReport(-1f, "Cloning / updating sd-scripts", isIndeterminate: true)); + // check if sd-scripts is already installed - if so: pull, else: clone + if (Directory.Exists(Path.Combine(installLocation, "sd-scripts"))) + { + await prerequisiteHelper + .RunGit(["pull"], onConsoleOutput, Path.Combine(installLocation, "sd-scripts")) + .ConfigureAwait(false); + } + else + { + await prerequisiteHelper + .RunGit( + ["clone", "-b", "sd3", "https://github.com/kohya-ss/sd-scripts"], + onConsoleOutput, + installLocation + ) + .ConfigureAwait(false); + } progress?.Report(new ProgressReport(-1f, "Setting up venv", isIndeterminate: true)); await using var venvRunner = await SetupVenvPure(installLocation).ConfigureAwait(false);