/usr/lib/foo/bar.rb:432:in `doit': undefined method `[]' for nil:NilClass (NoMethodError)but in bar.rb at the line 432 there are no square brackets. The user must be using an older version of the script. Can we find out which one without asking them?
Git can help. This code will go back in history and show the line how it appeared during the past. It's a history of a single line, kind of like "
git blame
" but in a different dimension.FILE=lib/foo/bar.rb
LINE=432
git log --format=format:%H $FILE \
| while read COMMIT_ID; do
echo -n $COMMIT_ID:$FILE:$LINE:
git show $COMMIT_ID:$FILE | sed -n "$LINE{p;q}"
done \
| less
Have I reinvented the wheel? What is its name?
No comments:
Post a Comment