bits 0x38 - Calender Week 04, 2024
Rants
Do I need a “Rant” section in my weekly post? For this one I’m kinda pissed.
TL;DR it is a human virtue to
- clean the commit history before submitting a PR on a collaborated project.
- never submit an incomplete series.
- prefer rebase over merge
So, someone opened a PR to merge their feature branch into the main
. That
feature is totally orthogonal to my parts and I’m not reviewing that PR, but
it’s trying to introduce the worst VCS practice into main
so I have to rant
about it.
The commit history in that series looks like this:
+------+
| PR 1 | this is a series by the same author, that was merged prior
+------+
|
+- commit with unclear message
+- commit with unclear message
+- commit with unclear message
PR1 is a partial implementation and NOTHING works.
+------+
| PR 2 | this is a series with 20+ commits in it.
+------+
|
+- commit 1 "add xyz"
+- commit 2 "Refine code"
+- commit 3 "Refine code"
+- commit 4 "Refine code"
+- commit 5 "revert commit 1"
+- commit 6 "add abc"
+- commit 7 "fix bug" (a bug in the same series)
+- commit 8 "merge branch main into <their own dev branch>"
+- commit 9 "fix typo"
+- commit 10 "temp"
+- .....
+- mumble mumble
+- .....
Just imagine having performed every single bad git practice in one single PR. In my opinion this whole series, given what it does, should be no more than 2 commits. Let’s breakdown the rant here.
- commit 8 is extremely bad compared to others. I guess, while they is working on their dev branch, the main got updated. They merged main into their dev branch to get updated. Perhaps they also fixed some conflicts. In this case: DON’T USE MERGE! Now you are trying to merge the merge back to main, what a mess!
- commit 2~4 for example, if they serve the same purpose, SQUASH them! this is trivial to do, especially when they are consecutive. And IMO they should not be in this PR in the first place! You are not “refining” any code outside of this series – even if you do, you should point out what code you are refining.
- commit 10 “temp”, are you kidding me?
- commit 5 “revert”, again, you are not revert anything outside of this very series, so why even bother putting it in your PR’s commit history?
- Actually these all boils down to the same problem: not using rebase.
- Oh I forgot to mention: this PR literally has conflicts with the main.
when it comes to a PR, no one is interested in learning your 心路历程(mental journel) during implementing that feature. It’s about WHAT are the most significant changes, it’s about COMMUNICATION! Please, keep that “shoping list(流水帐)” to yourself and let people understand what’s they are looking at.
If you don’t know how to use rebase, please go through this nice tutorial:
https://git-rebase.io/
Disclaimer: this rant has nothing to do with code quality, it’s not about how smart the code is, it’s about how you work with people.
Learns
the “hygiene” concepts in macros:
https://veykril.github.io/tlborm/syntax-extensions/hygiene.html
It’s about macros being their own syntax context, so that it’s not affected by its surroundings and vice versa.
tilde ~
On Unix-like operating systems (including AIX, BSD, Linux and macOS), tilde normally indicates the current user’s home directory. […] This convention derives from the Lear-Siegler ADM-3A terminal in common use during the 1970s, which happened to have the tilde symbol and the word “Home” (for moving the cursor to the upper left) on the same key.
on Rust optimization: return value optimization (RVO); copy elision
placement-by-return: https://y86-dev.github.io/blog/return-value-optimization/placement-by-return.html
P.S. I posted the findings on fediverse, and, I never expected it to get reposted 200+ times! Of course, who won’t appreciate such a beauty. To my awe some say in the comments that they worked with this specific terminal years back, and some even still have one! That’s a piece of tech way before I was born and :D
MISC
Dump a pagetabble, why not?
[+] click to leave a comment [+]
>> SEND COMMENT <<