git diff to patience algorithm