mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-03-02 22:57:32 -05:00
Conventions for commit messages #16799
Labels
No labels
Accessibility
AppImage
Bounty
Build system
CI
Can't reproduce
Code cleanup
Confirmed bug
Confirmed bug
Core
Crash
Data loss
Discussion
Docker
Documentation
Duplicate
Feature
Feature request
Feature request
Feature request
Filters
Flatpak
GUI
Has workaround
I2P
Invalid
Libtorrent
Look and feel
Meta
NSIS
Network
Not an issue
OS: *BSD
OS: Linux
OS: Windows
OS: macOS
PPA
Performance
Project management
Proxy/VPN
Qt bugs
Qt6 compat
RSS
Search engine
Security
Temp folder
Themes
Translations
Triggers
Waiting diagnosis
Waiting info
Waiting upstream
Waiting web implementation
Watched folders
WebAPI
WebUI
autoCloseOldIssue
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/qBittorrent#16799
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @sledgehammer999 on GitHub (Apr 22, 2025).
This is a continuation of a discussion started in https://github.com/qbittorrent/qBittorrent/pull/21971#issuecomment-2817859706
Purpose of this discussion: Explore ways to alleviate the changelog generation and maintenance
Proposal
Adopt Conventional Commits. It's ruleset is small and lax. It's a quick read.
There is tooling available for Convential Commits that generates changelog based on the commits.
I propose to start with very lax rules on how we write commits:
featfor features (supposedly these are not to be backported)fixfor true bugfixes that are supposed to be backported. Not for fixups of a previously unreleased state.fixtype.The tooling will be used to extract a changeset solely based on the
feat/fixtypes while ignoring all other commits.Discussion
Discuss possible problems that may arise from the above. And/or propose a different approach (but don't make a different proposal for the sake of it).
@sledgehammer999 commented on GitHub (Apr 22, 2025):
From https://github.com/qbittorrent/qBittorrent/pull/21971#issuecomment-2820522564
No, CC doesn't enforce spelling or capitalization. We can choose any type and scope. All tools can be configured to recognize the types/scopes we want.
Furthermore, the tools usually have facilities that can manipulate each found entry based on its type/scope. We define that behavior. It usually passes through a template. For now, assume that the changelog can be generated in the format we currently use.
I suppose we could use the scope that is the most relevant. Like what would be the likeliest changelog entry for this when I manually would make the entry? If many types are equally likely, just choose one.
Same as above.
Is it a single commit? Then it probably deserves the
feattype. Is it multiple commits? One of them gets thefeattype, the bugfixing one gets thefixtype, and the intermediate ones (if any) don't get a type.@Chocobo1 commented on GitHub (Apr 22, 2025):
Addressing comments from https://github.com/qbittorrent/qBittorrent/pull/21971#issuecomment-2820522564
I didn't see such rule in the spec. Also we don't need to follow https://www.conventionalcommits.org/en/v1.0.0/ literally. We can go our own way it if it don't diverge from the format too much and as long as we can still benefits from the changelog generator.
IMO if you need multiple entries in the changelog then create multiple git commits with each complying to the CC format. Otherwise you can use non-CC format for the commits you don't wish to be included in changelog.
@sledgehammer999 commented on GitHub (Apr 22, 2025):
In the meantime we should follow what I said in https://github.com/qbittorrent/qBittorrent/pull/21971#issuecomment-2817859706
ALSO we should simulate this proposal on the current/new PRs and imagine how they would look like. If we identify any problems we should comment on them here as a concrete illustritative example.
@glassez commented on GitHub (Apr 22, 2025):
If forgeting about CC and consider the above as a starting point, I would suggest simply adding the Changelog related information as a "special" section to the commit body (while leaving our current commit formatting rules as-is).
@Chocobo1 commented on GitHub (Apr 22, 2025):
To give something more concrete to discuss, here is how I would define the types and scopes:
And this is the result of a few commits on master:
Before:
After:
@glassez commented on GitHub (Apr 22, 2025):
Ok, let's give it a try.
At least if it has a clear indication of which commits should be mentioned in the Changelog and which should not, this in itself will simplify even the manual (semi-automatic) creation of the Changelog, right?
@glassez commented on GitHub (Apr 22, 2025):
@Chocobo1
How about merge commits?
@sledgehammer999 commented on GitHub (Apr 22, 2025):
My 2 cents:
I don't particularly like the format "Fix(WebUI)". I would prefer straight "WebUI: blah blah". At least for fixes and features.
For more context: Currently, for anything related to WebUI I almost always put it under the
WEBUIprefix in the changelog. In this case, I don't differentiate betweenBUGFIXandFEATURE. I useBUGFIXfor any fix NOT belonging to a distinct module. Same forFEATURE.@glassez commented on GitHub (Apr 22, 2025):
@Chocobo1
If Refactor is suggested as valid type I would use Feature instead of Feat.
@glassez commented on GitHub (Apr 22, 2025):
So how do you distinguish those commits that should be mentioned in the Changelog from those that shouldn't?
Maybe, on the contrary, it makes sense to revise the Changelog format too?
@glassez commented on GitHub (Apr 22, 2025):
One more question. How could the automated tool exclude from the Changelog those commits that were backported to the previous branch?
@xavier2k6 commented on GitHub (Apr 22, 2025):
Can output be like below? as in add
-after type, I think it's more readable...@glassez commented on GitHub (Apr 22, 2025):
IMO, using in prefix both hyphens and parentheses simultaneously is an overkill. But we can just add a space between type and scope:
@thalieht commented on GitHub (Apr 22, 2025):
Will this affect the 50 char limit for commit messages?
@glassez commented on GitHub (Apr 22, 2025):
This length was already tight enough, and given the mandatory prefixes, it will unlikely to contain enough information. I would suggest to make it equal to the maximum length that GitHub displays without cropping.
@Chocobo1 commented on GitHub (Apr 22, 2025):
It seems you are talking about the changelog, right? Then I suppose the changelog generator is able to detect WEBUI commits and put them into its own WEBUI section. And this won't affect how we write the commit title.
From https://git-cliff.org/docs/configuration/git#commit_parsers :
Sure.
Yes. All these hurdles are about generating changelog easier and faster. For the maintainer and the contributors.
I'll prefer leave them as-is and don't apply CC to them. The changelog generator should be able to ignore them.
Either manually filter them out or write some script to automate it.
From https://git-cliff.org/docs/configuration/git#commit_parsers :
For example, one can use
PR #NNNNto match and filter the changelog entries.@sledgehammer999 commented on GitHub (Apr 22, 2025):
Here I am talking about cosmetics in the git log, and giving context via what I do in the changelog.
Do you like git logs that look like this:
or like this:
or even this (ommitting
typefor internal commits):Personally I like number 2 and maybe number 3.
Do you mean entries like
Merge pull request #22482 from Chocobo1/process_env? Then I suggest we leave them as-is. The tools will ignore them. They aren't needed for the changelog.AFAICT it can't. However judging from the recent stable releases it will be easy to manually filter the backported changes when creating the 1st changelog of the new major release. The number of backports isn't big and a simple search&replace should do most of the work.
Lastly, I would vote to keep
Featas it is standard term in CC.@glassez commented on GitHub (Apr 22, 2025):
@sledgehammer999
As per above.
If you do not intend to have consistent commit titles, then I would prefer to leave everything as it is, and add the Changelog hints as a special field to the commit message body (as I suggested previously).
@sledgehammer999 commented on GitHub (Apr 22, 2025):
What do you mean by this? Or, better yet, how are my proposed titles inconsistent?
@glassez commented on GitHub (Apr 22, 2025):
If commit title has a prefix, then it must belong to a single classification. For example, "Fix", "Feature", "Refactor" belong to a single classification. "Fix" and "WebUI" not.
@Chocobo1 commented on GitHub (Apr 23, 2025):
TBH, I find adding prefix ugly. But if we are going to make changes and improve things. I would prefer it has clear logic structure and uniformity so that leaves option 2 and 3 out. I would choose option 1 or its variant.
@glassez commented on GitHub (Apr 23, 2025):
👍
I really dislike the way Conventional Commits do the job.
@Chocobo1 commented on GitHub (Apr 23, 2025):
And I mean all kinds of prefix. Like the current
GHA CI:andWebUI:etc. But lets not delve into it.Another idea is we utilize the commit footer (which is at the bottom of the commit body) and write some format that can help the changelog generator. This way we can keep using the usual commit title format. I have not think thoroughly about this though.
@glassez commented on GitHub (Apr 23, 2025):
Just like I suggested above. IMO, commit body (footer) is better place for some kind of service info.
The current prefixes were discussed and approved earlier to clearly distinguish commits that are not related to qBittorrent application itself. Otherwise, the titles of such commit would look either confusing or difficult to come up with, or too long, etc. But if you have any ideas on how to do it in another acceptable way, you're welcome (within separate Issue/PR).
@Chocobo1 commented on GitHub (Apr 23, 2025):
As a start (again). Maybe still use the defines from https://github.com/qbittorrent/qBittorrent/issues/22595#issuecomment-2821018905 but put it at the footer and only use the prefix part.
For example:
ps. I'm not sure but I hope the generator can be configured to support this.
@glassez commented on GitHub (Apr 23, 2025):
If it's going to be in commit body footer, then I don't really care what format it's going to use. This should be based more on what will be more convenient for processing by Changelog generator.
@sledgehammer999 commented on GitHub (Apr 24, 2025):
So, I guess the 3 of us don't really like CC (for different reasons each). So we should probably stop thinking about adopting CC.
Putting something in the footer/body sounds better and I almost agree. I want to raise the following POV and hear your opinion.
It seems to me that requiring a prefix in the title will be more intuitive for newcomers to follow. It will be easier to verify for reviewers, both in terms of correctness and in terms of existence.
On the other hand, a rule about a footer might be missed by a committer (even a regular one), and the reviewer might forget to check for it too.
However, it might be easy to write a CI check that checks for a footer, and posts a comment in the PR thread when missing (as a soft warning/reminder).
@glassez commented on GitHub (Apr 25, 2025):
Most of the changes are made by more or less permanent members.
In addition, we are usually dealing with a more complex process than simply merging the provided commit as it is. It requires squashing several intermediate commits, editing the message, and adding references to PR and closed Issue. So the final appearance of the merged commit is the (de facto) responsibility of the member who merges it.
@glassez commented on GitHub (Apr 25, 2025):
To make it easier for the Changelog generator to find the appropriate part of the message body, it could start with some permanent prefix:
@sledgehammer999 commented on GitHub (Apr 25, 2025):
Then I guess we should try it for a while. If it doesn't work, we scrap it.
Should we always require the footer? Or can it be omitted if the change is not changelog-worthy?
IMO, the person who merges (and the original author) should concern themselves with helping with the maintenance of a changelog. Not with providing context for every single commit/merge. Hence, only provide info when a changelog entry is needed.
As for the generator: We could implement a simple script ourselves.
git logprovides pretty formatting based on switches. The script will parse the body backwards from the end until a blank line is found (or the start is reached). This is the footer. Each line should be checked for a possible prefix eg<prefix>:<space><message>. We predefine the prefixes we care about.@glassez commented on GitHub (Apr 25, 2025):
👍
@Chocobo1 commented on GitHub (May 2, 2025):
About the prefix/format, if my proposal in https://github.com/qbittorrent/qBittorrent/issues/22595#issuecomment-2824256542 wasn't good enough then someone must propose something else so we don't stall here.
@glassez commented on GitHub (May 2, 2025):
I would assume that the commit body footer does not belong only to the Changelog generator. Therefore, I would use prefixes differently, i.e. so that they do not contain (only) Changelog related data, but distinguish those data from others: