镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

pre-push hook failed with "ValueError: too many values to unpack (expected 4)" #2344

Closed

Description

@wwade

describe your issue

I ran

git push --dry-run origin HEAD^"{/^[a-zA-Z]+: }":refs/for/main%wip

and expected the hook to run properly, but it failed with a somewhat subtle error:

An unexpected error has occurred: ValueError: too many values to unpack (expected 4)
Check the log at $HOME/.cache/pre-commit/pre-commit.log

It was more clear from the pre-commit.log file, though (see below). I reproduced the issue using HEAD (f9473e7) as well.

pre-commit --version

2.12.1

.pre-commit-config.yaml

repos:
  - repo: https://github.com/pre-commit/pre-commit-hooks
    rev: v3.2.0
    hooks:
      - id: check-added-large-files
      - id: check-json
      - id: check-yaml
      - id: end-of-file-fixer
      - id: trailing-whitespace

  - repo: https://github.com/wwade/pre-commit-golang
    rev: 503834f5c0933fbdf9a55e92329c1957e48f6d0a
    hooks:
      - id: go-fmt
      - id: go-imports
      - id: go-cyclo
        args: [-over=15]
      - id: validate-toml
      - id: golangci-lint
      - id: go-unit-tests
      - id: go-mod-tidy

~/.cache/pre-commit/pre-commit.log (if present)

version information

pre-commit version: 2.12.1
sys.version:
    3.8.10 (default, Mar 15 2022, 12:22:08) 
    [GCC 9.4.0]
sys.executable: /usr/bin/python3
os.name: posix
sys.platform: linux

error information

An unexpected error has occurred: ValueError: too many values to unpack (expected 4)
Traceback (most recent call last):
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/error_handler.py", line 65, in error_handler
    yield
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/main.py", line 357, in main
    return hook_impl(
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/commands/hook_impl.py", line 223, in hook_impl
    ns = _run_ns(hook_type, color, args, stdin)
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/commands/hook_impl.py", line 195, in _run_ns
    return _pre_push_ns(color, args, stdin)
  File "$HOME/.local/lib/python3.8/site-packages/pre_commit/commands/hook_impl.py", line 113, in _pre_push_ns
    _, local_sha, remote_branch, remote_sha = line.split()
ValueError: too many values to unpack (expected 4)

Activity

  1. wwade commented on Apr 14, 2022

    @wwade
    ContributorAuthor

    I have a fix coming 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions