Compare Directories in Vim

September 30, 2014

Today I had a problem that was caused by a recent update to a dependency. Unfortunately, it was not obvious which version caused the problem but I was able to manually narrow it down. Once I had determined the exact version that introduced the bug I needed to identify the exact change in that version that was causing my specific issue.

It turned out that looking at the git log was not helpful and actually more confusing than helpful. It appeared as though there was only one commit between the two releases in question. The one commit obviously had nothing to do with the issue that I was experiencing. At that point, I began to distrust the distributions of the package and think that the code in the package manager perhaps did not match what was in source control. Spoiler alert, at this point what I should have done was check to see if the versions were tagged (which they were) but I did not. Had I checked for tags I could have done the following to easily find the exact change that broke my world.

  git diff last.good.version first.bad.version path/to/file/in.question

What really happened, since I did not think of the whole git tag thing, led me to discover a really great Vim plugin called DirDiff. vimdiff will allow you to diff files, but you can only diff a single file to another single file at a time. DirDiff allows you to diff entire directories. I was able to pull down and extract the tarballs for the last good and the first bad versions of the package and use DirDiff to see the exact differences. Here is an example of using DirDiff to do a diff of two different versions of the capistrano-django rubygem.

DirDiff In Action

Being ignorant is not so much a shame, as being unwilling to learn. - Benjamin Franklin