-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
egit seems to ignore commit-msg hook, either in global git hooks or in repository hooks #74
Comments
This is a git-for-windows thing that is not implemented in JGit: if git-for-windows cannot find a hook "hook-name", it looks for a file "hook-name.exe" instead, and executes that. See git-for-windows/git@235be51fbe and the current code in hooks.c. STRIP_EXTENSION is defined as ".exe" on Windows... |
So are you saying that it would only use the "commit-msg" hook if the file name was exactly "commit-msg", not "commit-msg.exe"? If so, that would mean it couldn't actually execute the hook, as it would need the extension for that to run. This sure seems like a bug. |
Exactly. It's simply not implemented in JGit. Someone would have to sit down and do so. |
I thought perhaps I could fool it by also storing a file named "commit-msg" with no extension in the directory (empty file), but that appeared to also have no effect. |
I'm closing this as a duplicate of eclipse-jgit/jgit#128 then. |
I'm not using hooks, so I might be completely wrong, but wouldn't it be possible to have a non-exe hook script which calls the executable, forwards all arguments and delegates the return value, stdout, and errout? |
Well... as I looked through the code of JGit yesterday late at night I got the impression that calling hooks is not implemented at all on Windows. (Function |
Ok, if we DID have Cygwin or hopefully git bash installed on Windows, what would be required to get this working? I imagine I won't be able to directly use the native executable (.exe file), but if I can store a bash script called "commit-msg" that just executes the installed native application installed in the PATH, I could deal with that. I thought I read something about it detecting "cygpath" being in the global PATH. Cygwin doesn't require that, or at least that is not the case for me right now (I do have Cygwin installed), and I verified this by opening a cmd shell and looking at the PATH set there. |
Version
7.1.0.202411261347-r
Operating System
Windows
Eclipse version
2024-12
Bug description
I have developed a small Windows application that works perfectly fine as the "commit-msg" hook with command-line git. I use it to validate the presence of a JIRA ticket id in the commit comment. I've tested it with the command-line in several different variations, and it works perfectly fine. I then tried testing the same commit test cases in Eclipse, and it seems like it is ignoring the hook entirely. My initial testing was with a global hook, using the "core.hooksPath" property, but I also tested this by storing the executable in the ".git/hooks" subdirectory of the repository. That was also apparently ignored.
Actual behavior
I tested with a comment that did not have a valid jira ticket in the comment, and it did not block the commit.
Expected behavior
I should see an error message in the commit result dialog, and it should block the commit.
Relevant log output
I saw nothing in the Eclipse log relevant to this.
Other information
No response
The text was updated successfully, but these errors were encountered: