Preserve non-ASCII characters in commit messages

We weren't converting the commit message to UTF-8 before asking libgit2
to prettify it.
This commit is contained in:
Adam Roben 2012-06-27 11:35:11 -04:00
Родитель 36273355f6
Коммит fa5e0fbc1f
2 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -264,12 +264,13 @@ namespace LibGit2Sharp.Tests
Tree tree = repo.ObjectDatabase.CreateTree(td);
Commit commit = repo.ObjectDatabase.CreateCommit("message", DummySignature, DummySignature, tree, new[] { repo.Head.Tip });
Commit commit = repo.ObjectDatabase.CreateCommit("Ü message", DummySignature, DummySignature, tree, new[] { repo.Head.Tip });
Branch newHead = repo.Head;
Assert.Equal(head, newHead);
Assert.Equal(commit, repo.Lookup<Commit>(commit.Sha));
Assert.Equal("Ü message\n", commit.Message);
}
}
}

Просмотреть файл

@ -373,8 +373,8 @@ namespace LibGit2Sharp.Core
[DllImport(libgit2)]
public static extern int git_message_prettify(
byte[] message_out, // NB: This is more properly a StringBuilder, but it's UTF8
int buffer_size,
string message,
int buffer_size,
[MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8Marshaler))] string message,
bool strip_comments);
[DllImport(libgit2)]