cookiecutter-django: [bug] Pre-commit hooks errors on first commit

What happened?

git commit -m “Initial commit” [WARNING] Unstaged files detected. [INFO] Stashing unstaged files to /home/userl/.cache/pre-commit/patch1601055885. Trim Trailing Whitespace…Failed

  • hook id: trailing-whitespace
  • exit code: 1
  • files were modified by this hook

Fixing <app>/templates/base.html Fixing utility/install_python_dependencies.sh Fixing <app>/templates/account/password_reset_done.html

[WARNING] Stashed changes conflicted with hook auto-fixes… Rolling back fixes… [INFO] Restored changes from /home/bill/.cache/pre-commit/patch1601055885.

What should’ve happened instead?

Commit to git. This is blocking the commit process. Commit fails and log says file does not match after the trailing whitespace process changed the files.

Additional details

git output: Looking for git in: git Using git 2.28.0 from git

git rev-parse --git-dir Open repository: /home/bill/projects/dfwtaichi git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git check-ignore -v -z --stdin git check-ignore -v -z --stdin git check-ignore -v -z --stdin git check-ignore -v -z --stdin git show --textconv :dfwtaichi/templates/account/password_reset_done.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/account/password_reset_done.html git cat-file -s c59534afcf4b25c6f0c294d8c3730cf15f09e1d5 git show --textconv :dfwtaichi/templates/base.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/base.html git cat-file -s f37f1396ad7ca48c81e111d0b696c0201306d6ec git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git show --textconv :dfwtaichi/templates/account/password_reset_done.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/account/password_reset_done.html git cat-file -s c59534afcf4b25c6f0c294d8c3730cf15f09e1d5 git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git check-ignore -v -z --stdin git show --textconv :utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 git status -z -u git symbolic-ref --short HEAD git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git rev-parse master git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git show --textconv :utility/install_python_dependencies.sh git config --get commit.template git show --textconv :dfwtaichi/templates/base.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/base.html git cat-file -s f37f1396ad7ca48c81e111d0b696c0201306d6ec git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git show --textconv :dfwtaichi/templates/account/password_reset_done.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/account/password_reset_done.html git cat-file -s c59534afcf4b25c6f0c294d8c3730cf15f09e1d5 git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git status -z -u git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git symbolic-ref --short HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git show --textconv :config/settings/base.py git config --get commit.template git check-ignore -v -z --stdin git show --textconv HEAD:utility/install_python_dependencies.sh git show --textconv :utility/install_python_dependencies.sh git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh fatal: Not a valid object name HEAD git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 git check-ignore -v -z --stdin git branch git rm --cached -r – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh error: the following file has staged content different from both the file and the HEAD: utility/install_python_dependencies.sh (use -f to force removal) git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh fatal: Not a valid object name HEAD git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh fatal: Not a valid object name HEAD git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 git show --textconv :dfwtaichi/templates/account/password_reset_done.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/account/password_reset_done.html git cat-file -s c59534afcf4b25c6f0c294d8c3730cf15f09e1d5 git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git show --textconv :dfwtaichi/templates/base.html git ls-files --stage – /home/bill/projects/dfwtaichi/dfwtaichi/templates/base.html git cat-file -s f37f1396ad7ca48c81e111d0b696c0201306d6ec git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git checkout -q – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: Not a valid object name HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git show --textconv HEAD:utility/install_python_dependencies.sh git show --textconv :utility/install_python_dependencies.sh git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git status -z -u git checkout -q – /home/bill/projects/dfwtaichi/dfwtaichi/templates/base.html git symbolic-ref --short HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: Not a valid object name HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git show --textconv HEAD:utility/install_python_dependencies.sh git show --textconv :utility/install_python_dependencies.sh git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git status -z -u git checkout -q – /home/bill/projects/dfwtaichi/dfwtaichi/templates/account/password_reset_done.html git symbolic-ref --short HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: Not a valid object name HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git show --textconv HEAD:utility/install_python_dependencies.sh git show --textconv :utility/install_python_dependencies.sh git show --textconv :config/settings/base.py git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git status -z -u git checkout -q – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git symbolic-ref --short HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git check-ignore -v -z --stdin git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: Not a valid object name HEAD git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git show --textconv HEAD:utility/install_python_dependencies.sh git show --textconv :utility/install_python_dependencies.sh git show --textconv :config/settings/base.py git check-ignore -v -z --stdin git status -z -u git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git status -z -u git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git symbolic-ref --short HEAD git rev-parse master git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git show --textconv :config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: Not a valid object name HEAD fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git show --textconv HEAD:utility/install_python_dependencies.sh git show --textconv :utility/install_python_dependencies.sh git show --textconv :config/settings/base.py git config --get commit.template git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git status -z -u git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git symbolic-ref --short HEAD git rev-parse master fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git config --get commit.template git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git status -z -u git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git symbolic-ref --short HEAD git ls-tree -l HEAD – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/utility/install_python_dependencies.sh git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git show --textconv :config/settings/base.py git cat-file -s bdc181a51993964f5225d68b80e08eae70bf0d45 fatal: Not a valid object name HEAD git rev-parse master git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b git show --textconv HEAD:utility/install_python_dependencies.sh fatal: ambiguous argument ‘master’: unknown revision or path not in the working tree. Use ‘–’ to separate paths from revisions, like this: ‘git <command> [<revision>…] – [<file>…]’ git for-each-ref --sort -committerdate --format %(refname) %(objectname) git remote --verbose git show --textconv :utility/install_python_dependencies.sh git show --textconv :config/settings/base.py git config --get commit.template git ls-files --stage – /home/bill/projects/dfwtaichi/config/settings/base.py git cat-file -s 350adc7e53761a9193d5790d6fc2514c3197c83b

  • Host system configuration:
    • Version of cookiecutter CLI (get it with cookiecutter --version):
    • OS:
    • Python version:
    • Docker versions (if using Docker):
  • Options selected and/or replay file:
Logs:
$ cookiecutter https://github.com/pydanny/cookiecutter-django
project_name [Project Name]: ...

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (5 by maintainers)

Most upvoted comments

I had the same issue. Per the isort docs, adding the section below to setup.cfg will make isort compatible with black formatting.

[isort]
profile = black
multi_line_output = 3