bugtraq integration does not work well when bug ID needs to be a trailer
Summary
It can be useful to populate discrete data in a commit message as a trailer. This can make it very easy to extract certain pieces of information from the message with very high accuracy using git interpret-trailers
(or just by respecting git's trailer rules with manual parsing).
If the bug ID entered into the commit message needs to be a git trailer, there doesn't appear to be a reliable way to populate it via TortoiseGit's bugtraq integration in the commit message dialog.
What steps will reproduce the problem?
#1:
Attemptgit config --global bugtraq.message "Issue: %BUGID%"
git config --global bugtraq.append true
- Make a commit, populating the Bug-ID as 12345 and supplying a single line message like "Test commit"
What is the expected output? What do you see instead?
Git commit messages are supposed to have a single subject line, with any additional lines separated from the subject by a blank line. So I would expect:
Test commit
Issue: 12345
However, the resulting message is:
Test commit
Issue: 12345
So this approach would only seem to work if the message already had a manually-entered trailer.
#2
Attemptgit config --global bugtraq.message "\nIssue: %BUGID%"
git config --global bugtraq.append true
- Make a commit, populating the Bug-ID as 12345 and supplying a single line message like "Test commit"
- Make another commit, populating the Bug-ID as 12345 and supplying a commit message that contains another trailer like:
Test commit
Signed-off-by: Some One <someone@example.com>
What is the expected output? What do you see instead?
Since I have a newline in the bugtraq.message, I do basically get what I expect here, but it's not what I need if I want the "Issue: 23456" to be a trailer in the second message.
First message (good):
Test commit
Issue: 12345
Second message (bad):
Test commit
Signed-off-by: Some One <someone@example.com>
Issue: 12345
In the second message, "Signed-off-by" is no longer a valid trailer because git expects all trailers to be a single block as the last thing in the message, with no blank lines between them.
So this approach would only work if the commit message did not have a manually-entered trailer.
What version of TortoiseGit and Git are you using? On what operating system?
- Git: 2.44.0.windows.1
- TortoiseGit: 2.15.3.0 (20240317-75224a7a)
- Windows 11
Please provide any additional information below, e.g. possible fixes.
It would be nice if some additional config was possible (buqtraq.append = trailer
?) that told TortoiseGit explicitly that the bugtraq was meant to be a trailer, and ensured that it was correctly appended to the message as a separate trailer block (when no trailers exist in the message already) or as part of an existing trailer block (when trailers do exist in the message already).