MHN
Add a comment on Hacker News →
2 of 4 comments
  1. The 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

    1. In 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?)