Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
zhili1208 committed Jun 7, 2016
1 parent 1ddcb74 commit b6708e4
Showing 1 changed file with 20 additions and 1 deletion.
Expand Up @@ -185,7 +185,7 @@ public override void PendDeleteFiles(IEnumerable<string> fullPaths, string root,
HashSet<string> filesToPendDelete = new HashSet<string>();
foreach (var fullPath in fullPaths)
{
if (File.Exists(fullPath))
if (File.Exists(fullPath) && IsSourceControlBound(fullPath))
{
filesToPendDelete.Add(fullPath);
}
Expand Down Expand Up @@ -213,6 +213,25 @@ public override void PendDeleteFiles(IEnumerable<string> fullPaths, string root,
}
}
}
else
{
var filePendingChanges = PrivateWorkspace.GetPendingChanges(filesToPendDelete.ToArray());

if (filePendingChanges.Any())
{
PrivateWorkspace.Undo(filePendingChanges);
}

foreach (var pendingChange in filePendingChanges)
{
if (pendingChange.IsAdd)
{
// If a file was marked for add, it does not have to marked for delete
// Since, all the pending changes on the file are undone, no action needed here
filesToPendDelete.Remove(pendingChange.LocalItem);
}
}
}

if (filesToPendDelete.Any())
{
Expand Down

0 comments on commit b6708e4

Please sign in to comment.