Re: git: aa2539679084 - main - framework: cleanup conditional-indentations in Mk/
Date: Sun, 24 Apr 2022 17:51:33 UTC
On Sunday, 24 April 2022 12:07:00 CEST Tobias C. Berner wrote: > The branch main has been updated by tcberner: > > commit aa2539679084872cd84112e9df6bfee571570623 > > framework: cleanup conditional-indentations in Mk/ > > These white space changes contribute greatly to the readability of those > files. As we have a version control system, finding out the reasons for the > changes prior to these white space changes is still easily possible This is a nice moment to point at "git blame" -- which will tell you when a line was last changed, and by whom. Naive use of "git blame" will now point a lot of lines at tcberner@, even though it was just whitespace. You can tell "git blame" to ignore certain revisions, and so discover the original authors before the white-space changes. ## Ignoring certain commits Step 1: Create a file that lists the commits to ignore, with one full hash per line. Some projects canonically name this file .git-blame-ignore-revs. So you could make one like this: echo aa2539679084872cd84112e9df6bfee571570623 > .git-blame-ignore-revs ## Using the ignore-file Step 2: Tell "git blame" to use that file for ignores. Actually, "blame" is kind of an unfriendly name. We should be cheering for the people who create the software we use daily! You can add an alias, one that calls "blame" with a suitable ignore-revisions-file. To do so, add this to your ~/.gitconfig (if there is alread an [alias] section, just add the second line): [alias] cheer = blame --ignore-revs-file .git-blame-ignore-revs This will make, say, "git cheer Mk/Uses/angr.mk" show only the non-whitespace changes from tcberner@ Step 2a: If you think "git cheer" is too corny, you can tell git blame to always use a particular ignore file: git config --local blame.ignoreRevsFile .git-blame-ignore-revs That sents the ignore-revisions-file for the current repository (e.g. for ports) to the given name, and means that you can "git blame" without seeing the whitespace-changes. There are projects that keep an ignore-revisions-file in the repository itself, for use when there are big cosmetic but non-functional changes. I have one in many of my repositories, for when I decide that the clang-format files need tweaking, or I realise that Python with 3-space indents is 33% faster than with 4-space indents. [ade] (occasionally kidding)