4 ms·
> I was recently hunting down the reason for a single ! casting a string to a bool. The blame on the file lead to a large commit with details about the project,
by lamontcg 4y ago
> I was recently hunting down the reason for a single ! casting a string to a bool. The blame on the file lead to a large commit with details about the project, but nothing about why that specific line of code was changed.
> Was it an accident? Did it serve an actual purpose? I might never know.
You're never going to get that level of detail.
Particularly if it was an accident or done without really thinking about it--the original coder will never document that because they were literally not thinking about it.
New commit rule: always document what you weren't considering when you wrote the commit.
- Izkata 4y ago> > Was it an accident? Did it serve an actual purpose? I might never know. > You're never going to get that level of detail. I have! I once found a bug that was caused by a typo in a linting commit, something obviously unintentional. If it was squashed it would have taken a lot longer to figure that out. I also recently found issues in a common python 2 and 3 library where the code was broken in py2to3 and first-run-of-black commits. More places where it was obvious how and why the code was wrong because the formatting was a separate commit from the feature.