Skip to content

Commit fa004ce

Browse files
committed
enhance: unstaged renamed file should use git restore --staged <path> <org_path> instead of git restore --staged <path>
Signed-off-by: leo <[email protected]>
1 parent 6620bd1 commit fa004ce

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Commands/Restore.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public Restore(string repo, List<string> files, string extra)
2121
WorkingDirectory = repo;
2222
Context = repo;
2323

24-
StringBuilder builder = new StringBuilder();
24+
var builder = new StringBuilder();
2525
builder.Append("restore ");
2626
if (!string.IsNullOrEmpty(extra))
2727
builder.Append(extra).Append(" ");

src/ViewModels/WorkingCopy.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,7 +1675,11 @@ private async void UnstageChanges(List<Models.Change> changes, Models.Change nex
16751675
var step = changes.GetRange(i, Math.Min(10, count - i));
16761676
var files = new List<string>();
16771677
foreach (var c in step)
1678+
{
16781679
files.Add(c.Path);
1680+
if (c.Index == Models.ChangeState.Renamed)
1681+
files.Add(c.OriginalPath);
1682+
}
16791683

16801684
await Task.Run(() => new Commands.Restore(_repo.FullPath, files, "--staged").Use(log).Exec());
16811685
}

0 commit comments

Comments
 (0)