pre-commit-hooks-django icon indicating copy to clipboard operation
pre-commit-hooks-django copied to clipboard

Git rebase exception

Open faunris opened this issue 8 months ago • 1 comments

Hello, today I have got a exception while trying to reword commit message via interactive git rebase.

Steps to reproduce:

  1. git rebase -i HEAD~4
  2. reword for the first commit in the list
Untracked Django migrations checker...........................................................Failed
- hook id: check-untracked-migrations
- exit code: 1

fatal: ref HEAD is not a symbolic ref
Traceback (most recent call last):
  File "/Users/faunris/.cache/pre-commit/repohi2le7su/py_env-python3.12/bin/check-untracked-migrations", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/faunris/.cache/pre-commit/repohi2le7su/py_env-python3.12/lib/python3.12/site-packages/hooks/check_untracked_migrations.py", line 16, in main
    current_branch = get_current_branch()
                     ^^^^^^^^^^^^^^^^^^^^
  File "/Users/faunris/.cache/pre-commit/repohi2le7su/py_env-python3.12/lib/python3.12/site-packages/hooks/utils.py", line 14, in get_current_branch
    output = subprocess.check_output(BRANCH_CMD)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/faunris/.pyenv/versions/3.12.10/lib/python3.12/subprocess.py", line 466, in check_output
    return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/faunris/.pyenv/versions/3.12.10/lib/python3.12/subprocess.py", line 571, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['git', 'symbolic-ref', '--short', 'HEAD']' returned non-zero exit status 128.

.pre-commit-config.yaml

  - repo: https://github.com/ecugol/pre-commit-hooks-django
    rev: v0.4.0
    hooks:
      - id: check-untracked-migrations

faunris avatar Jun 08 '25 19:06 faunris