1

I'm implementing a prepare-commit-msg hook script that automatically fills out some values in the commit. It works fine, however it depends on a local file, which may not be present, or may not contain the value I'm looking for. In this case, I would like to offer the developer an option of manual input, which is then saved to the local file for re-use. It is also possible that on some branches the extra values are not needed at all.

What happens if I read from STDIN in the hook script? It might work if I commit from the command line, however what if I use some UI (such as Eclipse) to do the commit? Is it possible to solve this problem in any way other than to refuse the commit?

egbokul
  • 3,944
  • 7
  • 36
  • 54
  • possible duplicate of [How do I prompt the user from within a commit-msg hook?](http://stackoverflow.com/questions/3417896/how-do-i-prompt-the-user-from-within-a-commit-msg-hook) – Sascha Wolf Feb 25 '15 at 10:47
  • The approach suggested in this question worked for me in a `pre-commit` hook. I would assume it also does for a `prepare-commit-msg` hook. – Sascha Wolf Feb 25 '15 at 10:48
  • Thanks for the link, that covers the command line use case. If I do a commit from the UI, the prepare-commit-msg script doesn't seem to run, which is not ideal, but at least it does not mess things up. – egbokul Feb 25 '15 at 11:27

0 Answers0