Cosium / git-code-format-maven-plugin

A maven plugin that automatically deploys code formatters as pre-commit git hook

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"PatchApplyException: Cannot apply: HunkHeader" on Windows

VladRoscaDev opened this issue · comments

Hello,
This plugin is very good but i can't seem to get it to work.
I have a repo in wich i am trying to commit the files after installing the hook and i get the following error:
[ERROR] Failed tot execute goal com.cosium.code:git-code-format-maven-plugin:2.0:on-pre-commit (default-cli) on project test: org.eclipse.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[236,4->235,4] -> [Help 1]

I was just testing and i added some spaces, tabs and new lines to mess things up.
The manual command works perfectly and formats all files, but after i run the commit it fails again with the same error.

I have the following git configuration: git config core.autocrlf true; Because I saw some other posts out there that indicated this.
Also I tried using dos2unix.exe and unix2dos.exe and still the same result.
My operating system is Windows, but I use GitBash console.

Thank you for your time, and help!

Please provide your OS name and a repository or a test allowing to reproduce the issue.

The OS is specified Windows (10) you want the build version? I can't provide a repository because it is a local instance of gitlab running. If I can provider any other information i will help.
I noticed also that if I run the manual command i can commit now, but when i try to commit another file without running the manual format command it brakes with the above error.

I need a repository with a reproduction scenario. You could create a public sample repository only for this purpose.

Ok I will try to do that when I get some spare time.
Thank you for the response!