Repro steps:
In a repository where post-command hook is configured (such as a VFSForGit clone)
- Configure autocorrect:
git config help.autocorrect=prompt
- 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 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.