mirror of
https://github.com/sourcegit-scm/sourcegit.git
synced 2024-12-24 20:57:19 -08:00
enhance: ignore untracked files when staging all changes with INCLUDE UNTRACKED FILES
turned off (#577)
This commit is contained in:
parent
7c253637fc
commit
45869c27b8
2 changed files with 17 additions and 17 deletions
|
@ -5,17 +5,18 @@ namespace SourceGit.Commands
|
|||
{
|
||||
public class Add : Command
|
||||
{
|
||||
public Add(string repo, List<Models.Change> changes = null)
|
||||
public Add(string repo, bool includeUntracked)
|
||||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
Args = includeUntracked ? "add ." : "add -u .";
|
||||
}
|
||||
|
||||
public Add(string repo, List<Models.Change> changes)
|
||||
{
|
||||
WorkingDirectory = repo;
|
||||
Context = repo;
|
||||
|
||||
if (changes == null || changes.Count == 0)
|
||||
{
|
||||
Args = "add .";
|
||||
}
|
||||
else
|
||||
{
|
||||
var builder = new StringBuilder();
|
||||
builder.Append("add --");
|
||||
foreach (var c in changes)
|
||||
|
@ -28,4 +29,3 @@ namespace SourceGit.Commands
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -345,7 +345,7 @@ namespace SourceGit.ViewModels
|
|||
_repo.SetWatcherEnabled(false);
|
||||
if (changes.Count == _unstaged.Count)
|
||||
{
|
||||
await Task.Run(() => new Commands.Add(_repo.FullPath).Exec());
|
||||
await Task.Run(() => new Commands.Add(_repo.FullPath, _repo.IncludeUntracked).Exec());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1316,7 +1316,7 @@ namespace SourceGit.ViewModels
|
|||
{
|
||||
var succ = true;
|
||||
if (autoStage && _unstaged.Count > 0)
|
||||
succ = new Commands.Add(_repo.FullPath).Exec();
|
||||
succ = new Commands.Add(_repo.FullPath, _repo.IncludeUntracked).Exec();
|
||||
|
||||
if (succ)
|
||||
succ = new Commands.Commit(_repo.FullPath, _commitMessage, _useAmend).Exec();
|
||||
|
|
Loading…
Reference in a new issue