2024-02-28 18:59:59 -08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.Commands
|
|
|
|
|
{
|
|
|
|
|
public class Restore : Command
|
|
|
|
|
{
|
2024-04-17 05:05:40 -07:00
|
|
|
|
public Restore(string repo)
|
|
|
|
|
{
|
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = "restore . --source=HEAD --staged --worktree --recurse-submodules";
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
public Restore(string repo, List<string> files, string extra)
|
|
|
|
|
{
|
2024-02-28 18:59:59 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
|
|
|
|
|
StringBuilder builder = new StringBuilder();
|
|
|
|
|
builder.Append("restore ");
|
2024-03-31 01:54:29 -07:00
|
|
|
|
if (!string.IsNullOrEmpty(extra))
|
|
|
|
|
builder.Append(extra).Append(" ");
|
2024-02-28 18:59:59 -08:00
|
|
|
|
builder.Append("--");
|
2024-03-31 01:54:29 -07:00
|
|
|
|
foreach (var f in files)
|
|
|
|
|
builder.Append(' ').Append('"').Append(f).Append('"');
|
2024-02-28 18:59:59 -08:00
|
|
|
|
Args = builder.ToString();
|
2024-03-17 18:37:06 -07:00
|
|
|
|
}
|
2024-02-28 18:59:59 -08:00
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
|
}
|