News for hackers. Stuff that matters.
Re:Plotting the source code “TODO” history of the most popul... by cerved on Monday May 17, 2021 @05:33AM (#27181566)
I'll throw this into the mix

  git --no-pager grep -I --full-name --line-number 'TODO' |\
   sed 's/\(^[^:]*\):\([0-9]\+\):.*/\1\n\2/' |\
   xargs -d '\n' -n2 sh -c 'git --no-pager blame "$0" -L $1,$1'
Not blazing fast but I think it does okay-ish.

What it does:

1) git-grep for files that are checked in, not "binary" that contain the string 'TODO'

2) sed away the actual line contents (git-grep doesn't seem able to only output file:line-nr)

3) use xargs and sh to call git blame on that file:line-nr

This shows the last time the TODO line was modified, ie: it may have been created 10 years ago but somebody modified the last yesterday

edit: one might want to throw in --cached to git-grep to search the index and not just the current working-tree

There are no comments on this comment yet.