Например, файл .gitattributes
файла lg2s
содержит строку *.cs diff=csharp
. вывод кодов
using (var repo = new Repository(@"path\to\lg2s"))
{
var tree1 = repo.Lookup<Commit>("a845db9").Tree;
var tree2 = repo.Lookup<Commit>("d677741").Tree;
var patches = repo.Diff.Compare<Patch>(tree1, tree2);
foreach (var patch in patches)
{
Console.WriteLine(patch.Patch);
}
}
есть (кратко)
diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
@@ -59,8 +59,8 @@ namespace LibGit2Sharp
но вывод git bash
(вкратце)
diff --git a/LibGit2Sharp/RepositoryStatus.cs b/LibGit2Sharp/RepositoryStatus.cs
@@ -59,8 +59,8 @@ internal RepositoryStatus(Repository repo, StatusOptions optio
вторая строчка не та.
Похоже, есть подробное обсуждение Add .gitattributes support
libgit2/#508, но PR Add APIs for git attributes
libgit2/#516 объединен или нет?
Сколько языков теперь поддерживается?
Можем ли мы указать правила без файла gitattributes
?