dotfiles icon indicating copy to clipboard operation
dotfiles copied to clipboard

Tool to find TODO/FIXME only added in current branch

Open bew opened this issue 2 years ago • 0 comments

Brainstorm

git grep TODO main | sed 's/^[^:]\+://' > main_todos
git grep TODO HEAD | sed 's/^[^:]\+://' > head_todoes
combine head_todoes xor main_todos

That looks like it works, but I don't get the line numbers... (also: I also get TODOs that are in main but not my branch... I don't actually want them!) And if I add -n to git grep to have the line numbers, the combination might not work as the lines content don't match anymore ><


I could use git diff -U0 main.. to get a diff of all changes in the branch There might be some options to avoid doing work, give better output, like --no-relative, --no-renames.. Also, it should skip leading indents, a TODO is a TODO, whereever it's placed!

Could use some git diff parsing code from delta ?


(Thinking far: Could become a generic grep over changes in the branch?) Stackoverflow already saw that question, WITHOUT conclusive / acceptable results..

  • https://stackoverflow.com/questions/52617314/git-grep-across-all-new-and-modified-files-before-commit
  • https://stackoverflow.com/questions/24212372/script-to-find-all-todo-comments-created-on-a-git-branch There IS a solution here: https://stackoverflow.com/a/51263327 BUT that requires searching twice, once to get the matching strings, another one (slow?) to get full file locations+matching string..

=> It would be better to just use git diff output and fill in line numbers!

bew avatar Jan 27 '24 14:01 bew