Skip to content

Failing test for handling i18n.commitEncoding #530

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 37 additions & 1 deletion LibGit2Sharp.Tests/CommitFixture.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
Expand Down Expand Up @@ -879,5 +879,41 @@ public void CanCommitOnOrphanedBranch()
Assert.Equal(1, repo.Head.Commits.Count());
}
}

[Fact]
public void HandlesWrite_i18n_commitEncoding()
{
string encoding = "windows-1250";
string message = "This commit is created by Janusz Białobrzewski";
string path = CloneStandardTestRepo();
using (var repo = new Repository(path))
{
repo.Config.Set("i18n.commitEncoding", encoding);

var committer = new Signature("Janusz Białobrzewski", "jbialobr@o2.pl",
Epoch.ToDateTimeOffset(1244286496, 120));

Commit c = repo.Commit(message, committer, committer);

Assert.Equal(encoding, c.Encoding);
Assert.Equal(message, c.Message);
}
}

[Fact]
public void HandlesRead_i18n_commitEncoding()
{
string encoding = "windows-1250";
string message = "Message in windows1250 encoding. ąęćłóśźż";
string path = CloneStandardTestRepo();
using (var repo = new Repository(path))
{
Commit c = repo.Lookup<Commit>("44d6630d4c4917e3eacc3e585bee47e8908efedf");

Assert.NotNull(c);
Assert.Equal(encoding, c.Encoding);
Assert.Equal(message, c.Message);
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Add "1.txt" file beside "1" folder
Message in windows1250 encoding. ���󜟿
2 changes: 1 addition & 1 deletion LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/HEAD
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ref: refs/heads/master
ref: refs/heads/master
1 change: 1 addition & 0 deletions LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/ORIG_HEAD
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
32eab9cb1f450b5fe7ab663462b77d7f4b703344
1 change: 1 addition & 0 deletions LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/config
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,4 @@
[unittests]
longsetting = 15234
intsetting = 2
[i18n]
Binary file modified LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/index
Binary file not shown.
3 changes: 3 additions & 0 deletions LibGit2Sharp.Tests/Resources/testrepo_wd/dot_git/logs/HEAD
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
0000000000000000000000000000000000000000 4c062a6361ae6959e06292c1fa5e2822d9c96345 Tim Clem <timothy.clem@gmail.com> 1303768198 -0700 clone: from c:/GitHub/libgit2sharp/Resources/testrepo.git
4c062a6361ae6959e06292c1fa5e2822d9c96345 592d3c869dbc4127fc57c189cb94f2794fa84e7e Tim Clem <timothy.clem@gmail.com> 1303835722 -0700 commit: add more test files
592d3c869dbc4127fc57c189cb94f2794fa84e7e 32eab9cb1f450b5fe7ab663462b77d7f4b703344 nulltoken <emeric.fermas@gmail.com> 1320047537 +0100 commit: Add "1.txt" file beside "1" folder
32eab9cb1f450b5fe7ab663462b77d7f4b703344 32eab9cb1f450b5fe7ab663462b77d7f4b703344 Janusz Białobrzewski <jbialobr@o2.pl> 1381379423 +0200 checkout: moving from master to win1250
32eab9cb1f450b5fe7ab663462b77d7f4b703344 44d6630d4c4917e3eacc3e585bee47e8908efedf Janusz Białobrzewski <jbialobr@o2.pl> 1381379618 +0200 commit: Message in windows1250 encoding. ���󜟿
44d6630d4c4917e3eacc3e585bee47e8908efedf 32eab9cb1f450b5fe7ab663462b77d7f4b703344 Janusz Białobrzewski <jbialobr@o2.pl> 1381379656 +0200 checkout: moving from win1250 to master
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
0000000000000000000000000000000000000000 32eab9cb1f450b5fe7ab663462b77d7f4b703344 Janusz Białobrzewski <jbialobr@o2.pl> 1381379423 +0200 branch: Created from 32eab9cb1f450b5fe7ab663462b77d7f4b703344
32eab9cb1f450b5fe7ab663462b77d7f4b703344 44d6630d4c4917e3eacc3e585bee47e8908efedf Janusz Białobrzewski <jbialobr@o2.pl> 1381379618 +0200 commit: Message in windows1250 encoding. ���󜟿
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
x��=JD1����ۋC����@D,���7Fg��%Ã)]��"���܊��pf��;��v�;�a8�33 E6��E�C���$%#��E�̄�Sr��.�\:��@c$5+�N�9wT5y��d�KDcD���:�m(�v��>�*�^�c���as��U�v�+P8(��S�K-��?;��K�)�5,���� ���[ k�\N�/����������w��!a�
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
44d6630d4c4917e3eacc3e585bee47e8908efedf