From 766910c0ae2ff41a79c9be1c86e3773f97441093 Mon Sep 17 00:00:00 2001 From: Ari Vuollet Date: Thu, 9 May 2024 20:14:22 +0300 Subject: [PATCH] Fix rebuilding dependencies using Git with existing local folders --- Source/Tools/Flax.Build/Deps/Dependency.cs | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Source/Tools/Flax.Build/Deps/Dependency.cs b/Source/Tools/Flax.Build/Deps/Dependency.cs index c99dd0ee4..8d9d54c74 100644 --- a/Source/Tools/Flax.Build/Deps/Dependency.cs +++ b/Source/Tools/Flax.Build/Deps/Dependency.cs @@ -128,7 +128,7 @@ namespace Flax.Deps /// True if initialize submodules of the repository (recursive). public static void CloneGitRepo(string path, string url, string commit = null, string args = null, bool submodules = false) { - if (!Directory.Exists(Path.Combine(path, Path.GetFileNameWithoutExtension(url), ".git"))) + if (!Directory.Exists(Path.Combine(path, ".git"))) { string cmdLine = string.Format("clone \"{0}\" \"{1}\"", url, path); if (args != null) @@ -136,12 +136,12 @@ namespace Flax.Deps if (submodules) cmdLine += " --recurse-submodules"; - Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool); if (submodules) - Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool); } if (commit != null) - Utilities.Run("git", string.Format("reset --hard {0}", commit), null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", string.Format("reset --hard {0}", commit), null, path, Utilities.RunOptions.DefaultTool); } /// @@ -153,7 +153,7 @@ namespace Flax.Deps /// True if initialize submodules of the repository (recursive). public static void CloneGitRepoFast(string path, string url, string args = null, bool submodules = false) { - if (!Directory.Exists(Path.Combine(path, Path.GetFileNameWithoutExtension(url), ".git"))) + if (!Directory.Exists(Path.Combine(path, ".git"))) { string cmdLine = string.Format("clone \"{0}\" \"{1}\" --depth 1", url, path); if (args != null) @@ -161,9 +161,9 @@ namespace Flax.Deps if (submodules) cmdLine += " --recurse-submodules"; - Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool); if (submodules) - Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool); } } @@ -188,9 +188,9 @@ namespace Flax.Deps if (submodules) cmdLine += " --recurse-submodules"; - Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool); if (submodules) - Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool); } if (commit != null) @@ -217,7 +217,7 @@ namespace Flax.Deps Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool); if (submodules) - Utilities.Run("git", "submodule update --init --recursive", null, null, Utilities.RunOptions.DefaultTool); + Utilities.Run("git", "submodule update --init --recursive", null, path, Utilities.RunOptions.DefaultTool); if (commit != null) {