Skip to content

Restore previous errno after post command hook - #860

Merged
Johannes Schindelin (dscho) merged 1 commit into
microsoft:vfs-2.53.0from
tyrielv:tyrielv/postcommand-fix-help
Feb 10, 2026
Merged

Johannes Schindelin (dscho) merged 1 commit into
microsoft:vfs-2.53.0from
tyrielv:tyrielv/postcommand-fix-help

Conversation

@tyrielv

Copy link
Copy Markdown
  • [ x ] This change only applies to the virtualization hook and VFS for Git.

Test and fix for #859

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for finding and fixing this!

@tyrielv
Tyrie Vella (tyrielv) force-pushed the tyrielv/postcommand-fix-help branch from b8706ed to 7c70515 Compare February 10, 2026 18:27
@tyrielv
Tyrie Vella (tyrielv) changed the base branch from vfs-2.52.0 to vfs-2.53.0 February 10, 2026 18:28
@dscho

Copy link
Copy Markdown
Member
image

sigh Those PR builds have long passed, but apparently there's yet another glitch that prevents webhooks or notifications from being delivered.

@dscho
Johannes Schindelin (dscho) merged commit 1e32467 into microsoft:vfs-2.53.0 Feb 10, 2026
1 check passed
@dscho

Copy link
Copy Markdown
Member

I had to elevate to admin to "bypass" the "missing" check prerequisite.

Johannes Schindelin (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.
Johannes Schindelin (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.
Johannes Schindelin (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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Apr 20, 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Apr 20, 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Apr 20, 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Jun 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Jun 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Jun 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Sep 22, 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.
Johannes Schindelin (dscho) added a commit that referenced this pull request Oct 19, 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.
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.

Help messages not shown correctly when post command hook is present

3 participants