Skip to content

Help messages not shown correctly when post command hook is present #859

@tyrielv

Description

@tyrielv

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 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions