Create empty code-coverage branch and allow custom commit message#318
Conversation
Use `--orphan` instead of using the current branchs content and history. Set the commit title in an environment variable and only amend commits with that title to allow for custom commits.
|
The strategy is to always over-write the branch, every time. 1 commit. That is clear and simple and manageable. I don't understand: git commit -m "$GCOVR_COMMIT_MSG" without --amend Its already starting to expand the size of repositories which are using this methodology, but have a different commit message on code-coverage. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #318 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 23 23
Branches 10 10
=========================================
Hits 23 23 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
Strategy now: Usually the last commit is the coverage report. If it is amend. Else it might be unrelated so don't overwrite
That's why I added a variable to adjust it where desired. You can only have 1 branch for GH pages, can't you? So if anyone wants to add stuff (or maybe change) their commit will be squashed with the next coverage commit. Works but messy, so this simple check to amend only previously created coverage commits. Not everything. |
Just speculating, this creates a potential scenario
Many commits and the git branch keeps expanding. How about this: add support for a |
I would rather have that than e.g.
If that really becomes an issue it can be easily resolved with a rebase. But for now it isn't even clear it ever becomes an issue. So while I like your idea with 2 branches I'd leave that for later when and if required. |
|
The "mental model" for this branch, is that it's ephemeral and will be overwritten by the coverage reports. It's dangerous to commit anything to this branch which should be saved. Like saving to your local /tmp directories. What if the designers of the linux /tmp directory thought "we want to be careful not to lose people's files". And then the /tmp directory as we know it could not exist. It would be clearer to offer the feature of a "permanent-github-pages" branch, with a name mentioning "permanent". This feature, as envisioned by Vinnie, was "we overwrite the branch every time, one commit." If you start making exceptions, and then people depend on that exception, they use this exception, even once, they commit permanent files to the code-coverage branch, the design has become flawed, in my opinion. The code-coverage branch should be "owned" by the coverage reports. That is way to explain it, and view it. Don't create a loophole, and as soon as that exists, then people rely on it. Compel them to use another "permanent" branch from day-1, if they really need it. |
I agree with having, preferably, a single commit for the latest state. However this being git I would also understand having multiple to keep the coverage history as e.g. CodeCov does.
Ok then I'll go YAGNI the other way and change this if and when required. Reverted to always amend but kept the variable to allow for another commit message in a more visible place. Doesn't hurt IMO and avoids the duplication. I added 2 sentences in the doc with a summary of what I got out of this discussion and consider useful to know for users of this workflow. Please check if they capture it well enough. |
|
Yes, agreed with YAGNI, good idea. Later, if it appears developers need the feature, I hope we can follow something like the strategy I was mentioning. code review.. the amend flag is missing. |
|
Continuing from previous comment, on the topic of "multiple commits". An example: GCOVR code coverage report https://1145.json.prtest2.cppalliance.org/gcovr/index.html Build time: 2026-02-13 17:58:29 UTC |
ffe6d8e to
25a9806
Compare
Avoids people treating this branch as permanent in any way.
25a9806 to
6ce03c4
Compare
Uff, thanks for catching that! |
Use
--orphaninstead of using the current branchs content and history. Set the commit title in an environment variableand only amend commits with that title to allow for custom commits.See recent discussion
Before merge I'll delete the branch here to test it