8000 The case for the removal of overloads which take an identity from the configuration by nulltoken · Pull Request #1173 · libgit2/libgit2sharp · GitHub
[go: up one dir, main page]

Skip to content

The case for the removal of overloads which take an identity from the configuration #1173

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

Merged
merged 6 commits into from
Aug 23, 2015
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Favor Identity usage over Signature in tests
  • Loading branch information
nulltoken committed Aug 18, 2015
commit f211cbc1a57d184a9e29a5ec63dfe7e043b642a7
4 changes: 2 additions & 2 deletions LibGit2Sharp.Tests/CommitFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ public void CommitWithInvalidSignatureConfigThrows(string name, string email)
public void CanCommitWithSignatureFromConfig()
{
string repoPath = InitNewRepository();
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };

using (var repo = new Repository(repoPath, options))
Expand All @@ -586,7 +586,7 @@ public void CanCommitWithSignatureFromConfig()
AssertBlobContent(repo.Head[relativeFilepath], "nulltoken\n");
AssertBlobContent(commit[relativeFilepath], "nulltoken\n");

AssertCommitSignaturesAre(commit, Constants.Signature);
AssertCommitIdentitiesAre(commit, Constants.Identity);
}
}

Expand Down
6 changes: 3 additions & 3 deletions LibGit2Sharp.Tests/ConfigurationFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void CanReadStringValue()
[Fact]
public void CanEnumerateGlobalConfig()
{
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };

var path = SandboxStandardTestRepoGitDir();
Expand Down Expand Up @@ -200,7 +200,7 @@ public void CanFindInLocalConfig()
[Fact]
public void CanFindInGlobalConfig()
{
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };

var path = SandboxStandardTestRepoGitDir();
Expand Down Expand Up @@ -387,7 +387,7 @@ public void CanAccessConfigurationWithoutARepository(Func<string, string> localC
{
var path = SandboxStandardTestRepoGitDir();

string globalConfigPath = CreateConfigurationWithDummyUser(Constants.Signature);
string globalConfigPath = CreateConfigurationWithDummyUser(Constants.Identity);
var options = new RepositoryOptions { GlobalConfigurationLocation = globalConfigPath };

using (var repo = new Repository(path, options))
Expand Down
4 changes: 2 additions & 2 deletions LibGit2Sharp.Tests/FilterFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ public void CanFilterLargeFiles()
string attributesPath = Path.Combine(Directory.GetParent(repoPath).Parent.FullName, ".gitattributes");
FileInfo attributesFile = new FileInfo(attributesPath);

string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };

using (Repository repo = new Repository(repoPath, repositoryOptions))
Expand Down Expand Up @@ -377,7 +377,7 @@ private static FileInfo StageNewFile(IRepository repo, string contents = "null")

private Repository CreateTestRepository(string path)
{
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };
var repository = new Repository(path, repositoryOptions);
CreateAttributesFile(repository, "* filter=test");
Expand Down
10 changes: 5 additions & 5 deletions LibGit2Sharp.Tests/FilterSubstitutionCipherFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public void SmugdeIsNotCalledForFileWhichDoesNotMatchAnAttributeEntry()

string repoPath = InitNewRepository();
string fileName = Guid.NewGuid() + ".rot13";
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };
using (var repo = new Repository(repoPath, repositoryOptions))
{
Expand Down Expand Up @@ -61,7 +61,7 @@ public void CorrectlyEncodesAndDecodesInput()

string repoPath = InitNewRepository();
string fileName = Guid.NewGuid() + ".rot13";
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };
using (var repo = new Repository(repoPath, repositoryOptions))
{
Expand Down Expand Up @@ -106,7 +106,7 @@ public void WhenStagedFileDoesNotMatchPathSpecFileIsNotFiltered(string pathSpec,
string repoPath = InitNewRepository();
string fileName = Guid.NewGuid() + fileExtension;

string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };
using (var repo = new Repository(repoPath, repositoryOptions))
{
Expand Down Expand Up @@ -141,7 +141,7 @@ public void CleanIsCalledIfAttributeEntryMatches(string filterAttribute, string
string repoPath = InitNewRepository();
string fileName = Guid.NewGuid() + ".txt";

string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };
using (var repo = new Repository(repoPath, repositoryOptions))
{
Expand Down Expand Up @@ -172,7 +172,7 @@ public void SmudgeIsCalledIfAttributeEntryMatches(string filterAttribute, string
string repoPath = InitNewRepository();
string fileName = Guid.NewGuid() + ".txt";

string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var repositoryOptions = new RepositoryOptions { GlobalConfigurationLocation = configPath };
using (var repo = new Repository(repoPath, repositoryOptions))
{
Expand Down
8 changes: 4 additions & 4 deletions LibGit2Sharp.Tests/NoteFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ public void CreatingANoteW 6293 hichAlreadyExistsOverwritesThePreviousNote()
[Fact]
public void CanAddANoteWithSignatureFromConfig()
{
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
var options = new RepositoryOptions { GlobalConfigurationLocation = configPath };
string path = SandboxBareTestRepo();

Expand All @@ -183,7 +183,7 @@ public void CanAddANoteWithSignatureFromConfig()
Assert.Equal("I'm batman!\n", newNote.Message);
Assert.Equal("batmobile", newNote.Namespace);

AssertCommitSignaturesAre(repo.Lookup<Commit>("refs/notes/batmobile"), Constants.Signature);
AssertCommitIdentitiesAre(repo.Lookup<Commit>("refs/notes/batmobile"), Constants.Identity);
}
}

Expand Down Expand Up @@ -265,7 +265,7 @@ public void RemovingANonExistingNoteDoesntThrow()
[Fact]
public void CanRemoveANoteWithSignatureFromConfig()
{
string configPath = CreateConfigurationWithDummyUser(Constants.Signature);
string configPath = CreateConfigurationWithDummyUser(Constants.Identity);
RepositoryOptions options = new RepositoryOptions() { GlobalConfigurationLocation = configPath };
string path = SandboxBareTestRepo();

Expand All @@ -280,7 +280,7 @@ public void CanRemoveANoteWithSignatureFromConfig()

Assert.Empty(notes);

AssertCommitSignaturesAre(repo.Lookup<Commit>("refs/notes/" + repo.Notes.DefaultNamespace), Constants.Signature);
AssertCommitIdentitiesAre(repo.Lookup<Commit>("refs/notes/" + repo.Notes.DefaultNamespace), Constants.Identity);
}
}

Expand Down
18 changes: 9 additions & 9 deletions LibGit2Sharp.Tests/TestHelpers/BaseFixture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,11 @@ private static RepositoryOptions BuildFakeRepositoryOptions(SelfCleaningDirector
/// Creates a configuration file with user.name and user.email set to signature
/// </summary>
/// <remarks>The configuration file will be removed automatically when the tests are finished</remarks>
/// <param name="signature">The signature to use for user.name and user.email</param>
/// <param name="identity">The identity to use for user.name and user.email</param>
/// <returns>The path to the configuration file</returns>
protected string CreateConfigurationWithDummyUser(Signature signature)
protected string CreateConfigurationWithDummyUser(Identity identity)
{
return CreateConfigurationWithDummyUser(signature.Name, signature.Email);
return CreateConfigurationWithDummyUser(identity.Name, identity.Email);
}

protected string CreateConfigurationWithDummyUser(string name, string email)
Expand Down Expand Up @@ -361,13 +361,13 @@ protected string CreateConfigurationWithDummyUser(string name, string email)
/// Asserts that the commit has been authored and committed by the specified signature
/// </summary>
/// <param name="commit">The commit</param>
/// <param name="signature">The signature to compare author and commiter to</param>
protected void AssertCommitSignaturesAre(Commit commit, Signature signature)
/// <param name="identity">The identity to compare author and commiter to</param>
protected void AssertCommitIdentitiesAre(Commit commit, Identity identity)
{
Assert.Equal(signature.Name, commit.Author.Name);
Assert.Equal(signature.Email, commit.Author.Email);
Assert.Equal(signature.Name, commit.Committer.Name);
Assert.Equal(signature.Email, commit.Committer.Email);
Assert.Equal(identity.Name, commit.Author.Name);
Assert.Equal(identity.Email, commit.Author.Email);
Assert.Equal(identity.Name, commit.Committer.Name);
Assert.Equal(identity.Email, commit.Committer.Email);
}

protected static string Touch(string parent, string file, string content = null, Encoding encoding = null)
Expand Down
0