Issue968

Title Create a precommit hook to prepend the branch name in square brackets to commit messages
Priority feature Status resolved
Superseder Nosy List florian, jendrik, malte, patfer, rik, silvan, thomas
Assigned To silvan Keywords infrastructure
Optional summary

Created on 2020-06-30.15:27:25 by rik, last changed by silvan.

Messages
msg9638 (view) Author: silvan Date: 2020-07-16.13:26:33
I pushed fix.
msg9624 (view) Author: silvan Date: 2020-07-15.16:26:51
I'll look into it again. I also noticed that it didn't work for me when I tried to use it for a merge commit.
msg9623 (view) Author: florian Date: 2020-07-15.16:10:55
I just tried using the hook and it didn't work for me.
After installing it, I added a dummy file in an issue branch and commited the change with
  git commit -m "haaands"
The log shows the commit message as
  "haaands [issue923] haaands"

So the original message shows up before the message we want.

Also, to make the installation easier, it would be great if the hook was already executable. I think we discussed this in the code review.
msg9560 (view) Author: silvan Date: 2020-07-09.14:42:33
As discussed live with Malte and Jendrik, I merged this one.
msg9515 (view) Author: silvan Date: 2020-07-07.11:35:54
I updated the pull request: https://github.com/aibasel/rik-downward/pull/1/files
msg9405 (view) Author: florian Date: 2020-07-02.16:31:55
I had a look at the change and left some comments. The current hook automatically prepends the branch name to any commit message. I suggest to extend this, so it checks if the commit message already starts with the correct string and doesn't add it in this case (so we don't end up with "[main] [main] message").

It would also be nice to add a prepare-commit-msg hook that adds the string if you call "git commit" without the "-m" option. This way it would show up in the editor and it would remove the uncertainty about who is responsible for adding it.

Finally, issue973 lists some checks we want to do about what parents a commit can have (e.g., a commit on main, has to have another commit on main as its first parent.), in particular, this is in msg9380 and msg9376. Could you also add hooks for this?
msg9393 (view) Author: rik Date: 2020-07-01.20:55:12
A WIP solution is avaiable at https://github.com/aibasel/fast-downward-
issue968/pull/1/files

This currently includes an installation script and a hook which keeps all 
hooks up-to-date automatically. This might be entirely over-engineered and 
simply including the hook and requiring users to manually copy it into their 
.git/hooks folder and repeat this whenever some hook changes or gets added 
might suffice.
msg9358 (view) Author: silvan Date: 2020-06-30.16:17:57
(Moving message from summary to change note.)

We want to automatically prepend the branch name to all commits so we know to 
which branch a commit was made in hindsight.
History
Date User Action Args
2020-07-16 13:26:34silvansetstatus: chatting -> resolved
messages: + msg9638
2020-07-15 16:26:51silvansetmessages: + msg9624
2020-07-15 16:10:55floriansetstatus: resolved -> chatting
messages: + msg9623
2020-07-09 14:42:33silvansetstatus: in-progress -> resolved
messages: + msg9560
summary: TODOs: - Make sure this is consistent with the server-side hooks on github (part of issue973). Perhaps code can be shared. ->
2020-07-08 12:16:34maltesetnosy: + malte
2020-07-07 11:36:03silvansetassignedto: rik -> silvan
2020-07-07 11:35:54silvansetmessages: + msg9515
2020-07-02 17:23:37floriansetpriority: meta -> feature
keyword: + infrastructure
2020-07-02 16:31:56floriansetmessages: + msg9405
2020-07-01 20:55:12riksetmessages: + msg9393
summary: TODOs: - Make sure this is consistent with the server-side hooks on github (part of issue973). Perhaps code can be shared. -> TODOs: - Make sure this is consistent with the server-side hooks on github (part of issue973). Perhaps code can be shared.
2020-07-01 12:37:24maltesetsummary: TODOs: - Make sure this is consistent with the server-side hooks on github (part of issue973). Perhaps code can be shared.
2020-07-01 12:07:56floriansetpriority: wish -> meta
2020-06-30 16:17:57silvansetmessages: + msg9358
summary: We want to automatically prepend the branch name to all commits so we know to which branch a commit was made in hindsight. -> (no value)
2020-06-30 15:34:27thomassetnosy: + thomas
2020-06-30 15:27:25rikcreate