File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
src/BuiltInTools/dotnet-watch Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -407,19 +407,22 @@ async Task<ImmutableList<ChangedFile>> CaptureChangedFilesSnapshot(ImmutableDict
407
407
var changedFiles = NormalizePathChanges ( changedPaths )
408
408
. Select ( changedPath =>
409
409
{
410
+ // On macOS may report Update followed by Add when a new file is created or just updated.
411
+ // We normalize Update + Add to just Add and Update + Add + Delete to Update above.
412
+ // To distinguish between an addition and an update we check if the file exists.
413
+
410
414
if ( evaluationResult . Files . TryGetValue ( changedPath . Path , out var existingFileItem ) )
411
415
{
412
- // On macOS may report Update followed by Add when a new file is created or just updated.
413
- // We normalize Update + Add to just Add above.
414
- // To distinguish between an addition and an update we check if the file exists.
415
416
var changeKind = changedPath . Kind == ChangeKind . Add ? ChangeKind . Update : changedPath . Kind ;
416
417
417
418
return new ChangedFile ( existingFileItem , changeKind ) ;
418
419
}
419
420
421
+ // Do not assume the change is an addition, even if the file doesn't exist in the evaluation result.
422
+ // The file could have been deleted and Add + Delete sequence could have been normalized to Update.
420
423
return new ChangedFile (
421
424
new FileItem ( ) { FilePath = changedPath . Path , ContainingProjectPaths = [ ] } ,
422
- ChangeKind . Add ) ;
425
+ changedPath . Kind ) ;
423
426
} )
424
427
. ToImmutableList ( ) ;
425
428
You can’t perform that action at this time.
0 commit comments