mirror of
https://github.com/sourcegit-scm/sourcegit
synced 2025-06-07 20:04:59 +00:00
refactor: use git restore
instead of git reset
to unstage local changes (#1373)
Signed-off-by: leo <longshuang@msn.cn>
This commit is contained in:
parent
46231a759c
commit
e40ca4bbe0
3 changed files with 13 additions and 5 deletions
|
@ -1664,14 +1664,18 @@ namespace SourceGit.ViewModels
|
|||
}
|
||||
else if (count == _staged.Count)
|
||||
{
|
||||
await Task.Run(() => new Commands.Reset(_repo.FullPath).Use(log).Exec());
|
||||
await Task.Run(() => new Commands.Restore(_repo.FullPath, true).Use(log).Exec());
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int i = 0; i < count; i += 10)
|
||||
{
|
||||
var step = changes.GetRange(i, Math.Min(10, count - i));
|
||||
await Task.Run(() => new Commands.Reset(_repo.FullPath, step).Use(log).Exec());
|
||||
var files = new List<string>();
|
||||
foreach (var c in step)
|
||||
files.Add(c.Path);
|
||||
|
||||
await Task.Run(() => new Commands.Restore(_repo.FullPath, files, "--staged").Use(log).Exec());
|
||||
}
|
||||
}
|
||||
log.Complete();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue