end-of-file-fixer add always a new line for .gitignore files
See original GitHub issuedescribe your issue
After running pre-commit
hook end-of-file-fixer
it always add a new line for every .gitignore
file in our private repo. Subsequently, our job checker always fails after run --all-files
trying to fixes those files.
pre-commit --version
pre-commit 2.16.0
.pre-commit-config.yaml
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-yaml
- id: check-json
~/.cache/pre-commit/pre-commit.log (if present)
error information
An unexpected error has occurred: CalledProcessError: command: ('/usr/bin/git', '-c', 'submodule.recurse=0', 'checkout', '--', '.')
return code: 2
expected return code: 0
stdout: (none)
stderr:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this hook by deleting .git/hooks/post-checkout.
Traceback (most recent call last):
File "/usr/local/lib/python3.8/dist-packages/pre_commit/error_handler.py", line 65, in error_handler
yield
File "/usr/local/lib/python3.8/dist-packages/pre_commit/main.py", line 396, in main
return run(args.config, store, args)
File "/usr/local/lib/python3.8/dist-packages/pre_commit/commands/run.py", line 399, in run
exit_stack.enter_context(staged_files_only(store.directory))
File "/usr/lib/python3.8/contextlib.py", line 425, in enter_context
result = _cm_type.__enter__(cm)
File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.8/dist-packages/pre_commit/staged_files_only.py", line 98, in staged_files_only
with _intent_to_add_cleared(), _unstaged_changes_cleared(patch_dir):
File "/usr/lib/python3.8/contextlib.py", line 113, in __enter__
return next(self.gen)
File "/usr/local/lib/python3.8/dist-packages/pre_commit/staged_files_only.py", line 67, in _unstaged_changes_cleared
cmd_output_b(*_CHECKOUT_CMD, env=no_checkout_env)
File "/usr/local/lib/python3.8/dist-packages/pre_commit/util.py", line 154, in cmd_output_b
raise CalledProcessError(returncode, cmd, retcode, stdout_b, stderr_b)
pre_commit.util.CalledProcessError: command: ('/usr/bin/git', '-c', 'submodule.recurse=0', 'checkout', '--', '.')
return code: 2
expected return code: 0
stdout: (none)
stderr:
This repository is configured for Git LFS but 'git-lfs' was not found on your path. If you no longer wish to use Git LFS, remove this
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
generated .gitignore does not end in a newline #2456 - GitHub
Successfully merging a pull request may close this issue. added newlines at end of template gitignore files jmarca/phoenix. 2 participants.
Read more >git - Apply .gitignore on an existing repository already tracking ...
I recently added a .gitignore file under my project and I assume that tells Git to ignore the files listed in the file....
Read more >.gitignore file - ignoring files in Git | Atlassian Git Tutorial
Git ignore patterns are used to exclude certain files in your working directory from your Git history. They can be local, global, or...
Read more >How to Use a .gitignore File - Pluralsight
A .gitignore file is a plain text file where each line contains a pattern for ... First, you have to add a setting...
Read more >gitignore Documentation - Git
A gitignore file specifies intentionally untracked files that Git should ignore. Files already tracked by Git are not affected; see the NOTES below...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
can you show the actual contents? perhaps add
--show-diff-on-failure
?I’ll do — thanks in any case for your help.