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>
|
/// <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)
|
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);
|
string cmdLine = string.Format("clone \"{0}\" \"{1}\"", url, path);
|
||||||
if (args != null)
|
if (args != null)
|
||||||
@@ -140,12 +140,12 @@ namespace Flax.Deps
|
|||||||
if (submodules)
|
if (submodules)
|
||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool);
|
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||||
if (submodules)
|
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)
|
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>
|
/// <summary>
|
||||||
@@ -157,7 +157,7 @@ namespace Flax.Deps
|
|||||||
/// <param name="submodules">True if initialize submodules of the repository (recursive).</param>
|
/// <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)
|
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);
|
string cmdLine = string.Format("clone \"{0}\" \"{1}\" --depth 1", url, path);
|
||||||
if (args != null)
|
if (args != null)
|
||||||
@@ -165,9 +165,9 @@ namespace Flax.Deps
|
|||||||
if (submodules)
|
if (submodules)
|
||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool);
|
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||||
if (submodules)
|
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)
|
if (submodules)
|
||||||
cmdLine += " --recurse-submodules";
|
cmdLine += " --recurse-submodules";
|
||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, null, Utilities.RunOptions.DefaultTool);
|
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||||
if (submodules)
|
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)
|
if (commit != null)
|
||||||
@@ -221,7 +221,7 @@ namespace Flax.Deps
|
|||||||
|
|
||||||
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
Utilities.Run("git", cmdLine, null, path, Utilities.RunOptions.DefaultTool);
|
||||||
if (submodules)
|
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)
|
if (commit != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user