Skip to content

Cannot apply HunkHeader on Windows #49

Description

@msharathrajms

I am getting the below error.

Failed to execute goal com.cosium.code:git-code-format-maven-plugin:2.4:on-pre-commit (default-cli) on project qe-jira-soap: org.eclipse.jgit.api.errors.PatchApplyException: Cannot ap
ply: HunkHeader[1,9->1,5] -

I have added -X to the pre-commit script and here is the error log.

org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.cosium.code:git-code-format-maven-plugin:2.4:on-pre-commit (default-cli) on project qe-jira-soap: org.eclips
e.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[1,9->1,5]
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:153)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:145)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:116)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:80)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:307)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:193)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:106)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:863)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:288)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:199)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoExecutionException: org.eclipse.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[1,9->1,5]
at com.cosium.code.format.OnPreCommitMojo.doExecute(OnPreCommitMojo.java:25)
at com.cosium.code.format.AbstractModuleMavenGitCodeFormatMojo.execute(AbstractModuleMavenGitCodeFormatMojo.java:66)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:207)
... 20 more
Caused by: com.cosium.code.format.MavenGitCodeFormatException: org.eclipse.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[1,9->1,5]
at com.cosium.code.format.git.GitStagedFiles.format(GitStagedFiles.java:97)
at com.cosium.code.format.OnPreCommitMojo.onPreCommit(OnPreCommitMojo.java:30)
at com.cosium.code.format.OnPreCommitMojo.doExecute(OnPreCommitMojo.java:22)
... 23 more
Caused by: org.eclipse.jgit.api.errors.PatchApplyException: Cannot apply: HunkHeader[1,9->1,5]
at org.eclipse.jgit.api.ApplyCommand.apply(ApplyCommand.java:224)
at org.eclipse.jgit.api.ApplyCommand.call(ApplyCommand.java:138)
at com.cosium.code.format.git.GitStagedFiles.format(GitStagedFiles.java:92)
... 25 more

I am using CLI, Git version 2.23.0, Windows, Plugin version 2.4. I have a parent pom and added it to that, i am using again in a sub project and this is a multi module project.

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