Restore previous errno after post command hook#860
Merged
dscho merged 1 commit intomicrosoft:vfs-2.53.0from Feb 10, 2026
Merged
Restore previous errno after post command hook#860dscho merged 1 commit intomicrosoft:vfs-2.53.0from
dscho merged 1 commit intomicrosoft:vfs-2.53.0from
Conversation
derrickstolee
previously approved these changes
Feb 10, 2026
derrickstolee
left a comment
There was a problem hiding this comment.
Thanks for finding and fixing this!
b8706ed to
7c70515
Compare
dscho
approved these changes
Feb 10, 2026
derrickstolee
approved these changes
Feb 10, 2026
Member
Member
|
I had to elevate to admin to "bypass" the "missing" check prerequisite. |
dscho
added a commit
that referenced
this pull request
Apr 12, 2026
Test and fix for #859 : Repro steps: In a repository where post-command hook is configured (such as a VFSForGit clone) 1. Configure autocorrect: `git config help.autocorrect=prompt` 2. Run an misspelled command. For example, `git statuss` Expected output: ``` WARNING: You called a Git command named 'statuss', which does not exist. Run 'status' instead [y/N]? ``` Actual output: ``` failed to run command 'statuss': No error ``` I think the problem is that [run_post_command_hook](https://github.com/microsoft/git/blob/9db3c15f497c5d59a20bb2ff4d054ff687d08334/git.c#L503C1-L503C26) needs to save and restore errno, similar to how handle_alias does it. Otherwise, the errno from the failed command is overwritten by the successful errno from postcommand hook before the help autocorrect has a chance to examine it.
dscho
added a commit
that referenced
this pull request
Apr 17, 2026
Test and fix for #859 : Repro steps: In a repository where post-command hook is configured (such as a VFSForGit clone) 1. Configure autocorrect: `git config help.autocorrect=prompt` 2. Run an misspelled command. For example, `git statuss` Expected output: ``` WARNING: You called a Git command named 'statuss', which does not exist. Run 'status' instead [y/N]? ``` Actual output: ``` failed to run command 'statuss': No error ``` I think the problem is that [run_post_command_hook](https://github.com/microsoft/git/blob/9db3c15f497c5d59a20bb2ff4d054ff687d08334/git.c#L503C1-L503C26) needs to save and restore errno, similar to how handle_alias does it. Otherwise, the errno from the failed command is overwritten by the successful errno from postcommand hook before the help autocorrect has a chance to examine it.
dscho
added a commit
that referenced
this pull request
Apr 17, 2026
Test and fix for #859 : Repro steps: In a repository where post-command hook is configured (such as a VFSForGit clone) 1. Configure autocorrect: `git config help.autocorrect=prompt` 2. Run an misspelled command. For example, `git statuss` Expected output: ``` WARNING: You called a Git command named 'statuss', which does not exist. Run 'status' instead [y/N]? ``` Actual output: ``` failed to run command 'statuss': No error ``` I think the problem is that [run_post_command_hook](https://github.com/microsoft/git/blob/9db3c15f497c5d59a20bb2ff4d054ff687d08334/git.c#L503C1-L503C26) needs to save and restore errno, similar to how handle_alias does it. Otherwise, the errno from the failed command is overwritten by the successful errno from postcommand hook before the help autocorrect has a chance to examine it.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Test and fix for #859