Fix rebuilding dependencies using Git with existing local folders
This commit is contained in:
@@ -132,7 +132,7 @@ namespace Flax.Deps
|
||||
/// <param name="submodules">True if initialize submodules of the repository (recursive).</param>
|
||||
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)
|
||||
@@ -140,12 +140,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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -157,7 +157,7 @@ namespace Flax.Deps
|
||||
/// <param name="submodules">True if initialize submodules of the repository (recursive).</param>
|
||||
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)
|
||||
@@ -165,9 +165,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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,9 +192,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)
|
||||
@@ -221,7 +221,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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user