mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-05-21 04:04:59 +00:00
refactor: rewrite checkout/create branch with submodules
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
e446e97f28
commit
0f6c8976af
8 changed files with 136 additions and 65 deletions
|
@ -1,4 +1,7 @@
|
|||
namespace SourceGit.Commands
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace SourceGit.Commands
|
||||
{
|
||||
public class Submodule : Command
|
||||
{
|
||||
|
@ -42,6 +45,28 @@
|
|||
return Exec();
|
||||
}
|
||||
|
||||
public bool Update(List<Models.Submodule> modules, bool init, bool recursive, bool useRemote)
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
builder.Append("submodule update");
|
||||
|
||||
if (init)
|
||||
builder.Append(" --init");
|
||||
if (recursive)
|
||||
builder.Append(" --recursive");
|
||||
if (useRemote)
|
||||
builder.Append(" --remote");
|
||||
if (modules.Count > 0)
|
||||
{
|
||||
builder.Append(" --");
|
||||
foreach (var module in modules)
|
||||
builder.Append($" \"{module.Path}\"");
|
||||
}
|
||||
|
||||
Args = builder.ToString();
|
||||
return Exec();
|
||||
}
|
||||
|
||||
public bool Delete(string relativePath)
|
||||
{
|
||||
Args = $"submodule deinit -f \"{relativePath}\"";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue