porting a c# implementation of git diff to javascript.