Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix an issue with FastFetch when deleting files #1730

Merged
merged 1 commit into from
Mar 31, 2021

Conversation

SteveBenz
Copy link
Contributor

This fixes #1729 and also takes care of a performance problem in the same method.

}

deletedPaths.Add(filePath);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line here is really the heart of the badness. I believe if we just deleted this one line, it would not only fix the bug but also greatly reduce the performance problem. We know for sure that 'filePath' is a file, and really 'deletedPaths' should always have been 'deletedFolders'. It would also greatly reduce the performance problem, as it'd reduce it from O(n^2) to something more like O(n logn) (because the number of directories is more or less log(number-of-files).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that this has a performance improvement as well.

@@ -90,10 +90,10 @@ public void CanParseBackwardsDiff()
diffBackwards.RequiredBlobs.Count.ShouldEqual(10);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is not all that it could be...

  1. It just tests counts. It'd be better if it ToString'ed the filenames that are in each set (where possible) so that when it fails you have some idea of what changed.
  2. It calls 'ParseDiffFile' rather than 'PerformDiff'. This misled me into thinking that 'PerformDiff' really didn't have any tests. 'ParseDiffFile', as it turns out, is just called by tests. It'd be better (and not hard to do) to make it call 'PerformDiff'.

Wouldn't take much to twist my arm to do that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry too much about that. I imagine it would be difficult to modify the code in a way that is incorrect and still gets these numbers correct.

@@ -1,4 +1,4 @@
@ECHO OFF
@if "%_echo%"=="" (echo off) else (echo on)
SETLOCAL
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I hope you don't mind a drive-by. I had some struggles getting these to run. We use this technique a bit around here to allow conditionally turning echo on to help diagnose the random "Error: wheel fell off" messages you get when running batch scripts in slightly incorrect environments"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. As long as the CI builds still pass with these messages, then I'm happy with the change.

Copy link
Contributor

@derrickstolee derrickstolee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for finding and fixing this.

@@ -1,4 +1,4 @@
@ECHO OFF
@if "%_echo%"=="" (echo off) else (echo on)
SETLOCAL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me. As long as the CI builds still pass with these messages, then I'm happy with the change.

}

deletedPaths.Add(filePath);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that this has a performance improvement as well.

@@ -90,10 +90,10 @@ public void CanParseBackwardsDiff()
diffBackwards.RequiredBlobs.Count.ShouldEqual(10);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry too much about that. I imagine it would be difficult to modify the code in a way that is incorrect and still gets these numbers correct.

@derrickstolee derrickstolee merged commit c42d132 into microsoft:master Mar 31, 2021
derrickstolee added a commit that referenced this pull request Jul 15, 2021
Major Updates
----------------

* Comes with `microsoft/git` v2.32.0.vfs.0.4.
* This release will be available via `winget`.
* The `gvfs upgrade` verb is deprecated. Any future updates will be taken via `winget`.
* This version of Git has an upgrade mechanism that can advance independently of VFS for Git. Run `git update-microsoft-git` to update your Git version.
* The build system has been updated to use a more recent version of .NET.
* All macOS and POSIX code has been removed to simplify the build system.
* A FastFetch bug around deleting files has been fixed.
* A prefetch bug around downloading a small number of files has been fixed.

Special thanks to contributors @ldennington, @tyrielv, @50Wliu, and @SteveBenz.

Pull Requests
---------------

* #1738: Bumping version of update-winget action
* #1747: UpgradeVerb: write deprecation notice
* #1745: do not exit early if no blobs found for a period when prefetching
* #1740: Skip launching UI if running unattended
* #1737: Update Git to v2.32.0
* #1746: Delete custom upgrader
* #1741: Fix winget tag specification
* #1744: Overhaul build and project systems and drop Mac/POSIX code
* #1736: Update Git to v2.31.1.vfs.0.3
* #1735: Bumping winget action version
* #1734: Adding winget workflow
* #1733: Update Git to include 2.31.1
* #1730: Fix an issue with FastFetch when deleting files
* #1732: Use one NuGet feed
* #1726: Config: commitGraph.generationVersion=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

FastFetch fails to delete files in some circumstances
2 participants