I use git
and bugs-everywhere
in my project. If you don't know the latter, it's a simple text file based issue tracker, i.e. bugs are simply files, and modifying them is done with the command-line tool be
. The files themselves are stored in the git repository. The idea of bugs-everywhere
is to keep the issue statuses in sync with the code you commit.
What I'd like to achieve: If a programmer commits changes and references the bug in the message he just fixed / feature he implemented (e.g. the message is something like fixed #123
), I'd like to mark the issue as done using the corresponding be
command. This obviously changes the issue file. I then want these changes to be included in the current commit.
Since I need to parse the commit message, I can't use a pre-commit
hook but need to use a commit-msg
hook. But I can't find any information whether or not it is possible to change what is being committed but only the message for the commit.
My idea is, in the commit-msg
hook, to always reject such commits, but also do another commit which includes the corresponding changes in the issue file. This leaves some open questions:
- Is it possible to do a commit during a commit-msg hook?
- Is it possible to reliably find out which files the user wanted to commit originally? (I guess I can simply use the comment lines in the commit message, but aren't they possibly truncated?)
Or is there a different approach you can think of?
Another idea, not really solving the above problem, is to only use the hook to check if the programmer already marked the issue as done. My primary goal is to avoid forgetting to mark the issue as done.