- Notifications
You must be signed in to change notification settings - Fork 45
Description
What steps will reproduce the problem?
Steps to reproduce the behavior:
- mvn git-code-format:install-hooks
- Change some code
- run git commit -m "exclude for now"
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
What is the expected output?
Githook should be triggered and code should be formatted
What happens instead?
Terminal output
'C:\Program' is not recognized as an internal or external command,
operable program or batch file.
Environment:
- OS: Windows 10
- Git version: git version 2.27.0.windows.1
- git-code-format-maven-plugin version: 2.5
Link to a git repository that can be cloned to reproduce the problem:
This is happens on my machine only. The reason is because in ~\IdeaProjects{project_name}.git\hooks{project_name}.git-code-format.pre-commit content has a .cmd postfix which cause the prehook command to fail.
Additional context
I solved this by removing .cmd postfix in {project_name}.git-code-format.pre-commit file
Before
#!/bin/bash
set -e
"C:/Program Files/JetBrains/IntelliJ IDEA 2019.1.4/plugins/maven/lib/maven3/bin/mvn.cmd" -f "C:/Users/{home}/IdeaProjects/{project_name}/pom.xml" com.cosium.code:git-code-format-maven-plugin:on-pre-commit
After
#!/bin/bash
set -e
"C:/Program Files/JetBrains/IntelliJ IDEA 2019.1.4/plugins/maven/lib/maven3/bin/mvn" -f "C:/Users/{home}/IdeaProjects/{project_name}/pom.xml" com.cosium.code:git-code-format-maven-plugin:on-pre-commit