Skip to content
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

pre-push: fix stdin line splitting when <local ref> has whitespace #2345

Merged
merged 1 commit into from Apr 14, 2022

Commits on Apr 14, 2022

  1. pre-push: fix stdin line splitting when <local ref> has whitespace

    From the `pre-push.sample` file:
    
    > Information about the commits which are being pushed is supplied as
    > lines to the standard input in the form:
    >
    >   <local ref> <local sha1> <remote ref> <remote sha1>
    
    When `<local ref>` is not simply a branch name, but a more general
    ref (see git-rev-parse(1)), it could contain whitespace, and that
    breaks the split() call that expected only 3 spaces in the line.
    
    Changed to use `rsplit(maxsplit=3)` since only the <local ref> is
    likely to have embedded whitespace.
    
    Added a new test case for the same.
    wwade committed Apr 14, 2022
    Copy the full SHA
    feb0d34 View commit details
    Browse the repository at this point in the history