-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
mingw: improve performance of mingw_unlink() #2589
mingw: improve performance of mingw_unlink() #2589
Conversation
Update mingw_unlink() to first try to delete the file with existing permissions before trying to force it. Windows throws an error when trying to delete a read-only file. The mingw_unlink() compatibility wrapper always tries to _wchmod(666) the file before calling _wunlink() to avoid that error. However, since most files in the worktree are already writable, this is usually wasted effort. Update mingw_unlink() to just call DeleteFileW() directly and if that succeeds return. If that fails, fall back into the existing code path to update the permissions and use _wunlink() to get the existing error code mapping. Signed-off-by: Jeff Hostetler <jeffhost@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like it!
@jeffhostetler I think we should do both. Are you totally opposed to having it in Git for Windows early? It's such a trivial patch, it will be simply skipped from the rebase once it arrives in any official Git version. |
@dscho I’m ok with including in both. i was just trying to not cause you more work later. i’ll update and merge this and send one to GGG and the list on monday. thanks. |
Excellent! |
@jeffhostetler any reason you didn't create a PR against |
@derrickstolee I'll merge this into GFW as is. Then cherry-pick it into vfs so we can test it there. And then send a patch to the mailing list via GGG. |
Worktree updates (e.g. `git checkout`, `git reset --hard`) [got a performance boost in sparse checkouts](git-for-windows/git#2589). Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
…f-gfw mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
mingw: improve performance of mingw_unlink()
…f-gfw mingw: improve performance of mingw_unlink()
Update mingw_unlink() to first try to delete the file with existing
permissions before trying to force it.
Windows throws an error when trying to delete a read-only file. The
mingw_unlink() compatibility wrapper always tries to _wchmod(666) the
file before calling _wunlink() to avoid that error. However, since
most files in the worktree are already writable, this is usually
wasted effort.
Update mingw_unlink() to just call DeleteFileW() directly and if that
succeeds return. If that fails, fall back into the existing code path
to update the permissions and use _wunlink() to get the existing
error code mapping.
Signed-off-by: Jeff Hostetler jeffhost@microsoft.com