``` var patches = repo0.Diff.Compare<Patch>(commit1?.Tree, commit2.Tree, Enumerable.Repeat(change.Path, 1), compareOptions: compareOptions); ``` Getting patches + applying them to file does not seems to work if there are unicode characters in file itself. Have tried to save it in utf8, but problem still persists. As a walkaround to this problem, I have added extra comparison that there aren't any unicode characters. ``` // If we have some unicode characters, then cannot be handled as text diff. canBeHandledAsTextPatch = strpatches.All(c => c <= 255); ``` But, libgit itself has built in support for patching, See https://libgit2.org/libgit2/#HEAD, `git_apply*` function calls - but none of these operations seems to be supported in `libgit2sharp`.