2024-02-05 23:08:37 -08:00
|
|
|
|
using System.Collections.Generic;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
using System.Text;
|
|
|
|
|
|
2024-03-17 18:37:06 -07:00
|
|
|
|
namespace SourceGit.Commands
|
|
|
|
|
{
|
|
|
|
|
public class Add : Command
|
|
|
|
|
{
|
2024-10-20 03:32:05 -07:00
|
|
|
|
public Add(string repo, bool includeUntracked)
|
|
|
|
|
{
|
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
|
|
|
|
Args = includeUntracked ? "add ." : "add -u .";
|
|
|
|
|
}
|
2024-10-23 00:28:09 -07:00
|
|
|
|
|
2024-10-20 03:32:05 -07:00
|
|
|
|
public Add(string repo, List<Models.Change> changes)
|
2024-03-17 18:37:06 -07:00
|
|
|
|
{
|
2024-02-05 23:08:37 -08:00
|
|
|
|
WorkingDirectory = repo;
|
|
|
|
|
Context = repo;
|
2021-04-29 05:05:55 -07:00
|
|
|
|
|
2024-10-20 03:32:05 -07:00
|
|
|
|
var builder = new StringBuilder();
|
|
|
|
|
builder.Append("add --");
|
|
|
|
|
foreach (var c in changes)
|
2024-03-17 18:37:06 -07:00
|
|
|
|
{
|
2024-10-20 03:32:05 -07:00
|
|
|
|
builder.Append(" \"");
|
|
|
|
|
builder.Append(c.Path);
|
|
|
|
|
builder.Append("\"");
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
2024-10-20 03:32:05 -07:00
|
|
|
|
Args = builder.ToString();
|
2021-04-29 05:05:55 -07:00
|
|
|
|
}
|
|
|
|
|
}
|
2024-03-31 01:54:29 -07:00
|
|
|
|
}
|