Cregit-Linux: how code gets into the kernel
7 points by follower 3 months ago | 4 comments- follower 3 months agoThe linked site contains a token-based (rather than line-based) git "blame" annotation view for Linux kernel releases, i.e. it allows you to discover which commit added a particular token--where "a token is what the C syntax considers a token".
An advantage of a per-token commit attribution view is you don't need to transit through the history of an entire line.
Cregit is the tool used to produce the per-token view: https://github.com/cregit/cregit
I encountered Cregit recently while doing some "code history spelunking/archaeology" and thought it seemed pretty nifty.
Decided to share the link as there have been a couple of recent HN threads which included discussion about the poor granularity of line-based git "blame" functionality.
The most recent kernel version on the site is v6.13: https://cregit.linuxsources.org/code/6.13/
Unfortunately, the tool itself seems not to be under active development, the most recently modified branch is from 2 years ago & the main branch was last modified 6 years ago: https://github.com/cregit/cregit/tree/newinter
- follower 3 months agoIn my case the particular code I was digging into was within the function `squash_the_stupid_serial_number(...)` as seen here: https://cregit.linuxsources.org/code/6.13/arch/x86/kernel/cp...
Unfortunately the direct line-number link above doesn't seem to provide the same view as manually choosing "squash_the_stupid_serial_number(...)" rather than "Overall" in the selection/option menu accessible via the page link: https://cregit.linuxsources.org/code/6.13/arch/x86/kernel/cp...
(Apparently the only code directly from Linus' original commit for that function is `, lo, hi`. :) And, unfortunately, being from the pre-git era, it is lacking any sort of informative commit message...)
Also, as the documentation mentions the token-tracing isn't perfect, e.g. the `squash_the_stupid_serial_number` name did actually exist before the cregited commit: https://github.com/torvalds/linux/commit/0a488a53d7ca46ac638...
(Perhaps this could be related to there being multiple function implementations selected via #ifdef?)
- zvr 3 months agoThis is extremely useful when you're looking for granularity finer that a line. Being able to have "blame"-like functionality per token is wonderful, when needed.
My personal use case was when trying to decide origin of some code. Instead of getting who touched "something on the line" (which might be a comment after the code), you really get where each piece is coming from.
- follower 3 months ago
- thatguy27 3 months agoHas anyone managed to build cregit [1] recently?