Frage

I am planning to replace the usage of git.exe from windows path by libgit2sharp for my plugin GitDiffMargin, A Visual Studio 2012 extension to display Git Diff on the margin of the current file. - https://github.com/laurentkempe/GitDiffMargin

I would like to know if there is an equivalent in libgit2sharp to get the same information as when running git diff --unified=0 on a file?

War es hilfreich?

Lösung

It looks like libgit2 supports changing context lines, but currently LibGit2Sharp is hard-coded to use 3: https://github.com/libgit2/libgit2sharp/blob/6a2d99ecdf35288df88c0e6fe8985969042d82a6/LibGit2Sharp/Diff.cs#L27

I've created https://github.com/libgit2/libgit2sharp/issues/423 to track the feature request.

Update:

As of v0.12 (or whatever comes after v0.11), you can do this:

var co = new CompareOptions
         {
             ContextLines = 0,
         };
var tc = repo.Diff.Compare(new[] { filename }, co);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top