Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2sharp.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@microsoft.com>2013-01-09 21:29:37 +0400
committernulltoken <emeric.fermas@gmail.com>2013-01-29 02:08:39 +0400
commit258fa7e3412f63e1c620850943f8705128c491ae (patch)
tree0070d908c4b22f7123a36ddc6823f99d7e1a5f3f /LibGit2Sharp.Tests/CommitFixture.cs
parent742f5b831469932a2c3af645d3d8d8c0f506950e (diff)
Teach Repository.Commit() to add merged branches as parents
Diffstat (limited to 'LibGit2Sharp.Tests/CommitFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/CommitFixture.cs23
1 files changed, 22 insertions, 1 deletions
diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs
index ef101176..1a20ab04 100644
--- a/LibGit2Sharp.Tests/CommitFixture.cs
+++ b/LibGit2Sharp.Tests/CommitFixture.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -528,6 +528,27 @@ namespace LibGit2Sharp.Tests
}
[Fact]
+ public void CommitParentsAreMergeHeads()
+ {
+ TemporaryCloneOfTestRepo path = BuildTemporaryCloneOfTestRepo(StandardTestRepoPath);
+ using (var repo = new Repository(path.RepositoryPath))
+ {
+ repo.Reset(ResetOptions.Hard, "c47800");
+
+ CreateAndStageANewFile(repo);
+
+ string mergeHeadPath = Path.Combine(repo.Info.Path, "MERGE_HEAD");
+ File.WriteAllText(mergeHeadPath, "9fd738e8f7967c078dceed8190330fc8648ee56a\n");
+
+ Commit newMergedCommit = repo.Commit("Merge commit", DummySignature, DummySignature, false);
+
+ Assert.Equal(2, newMergedCommit.Parents.Count());
+ Assert.Equal(newMergedCommit.Parents.First().Sha, "c47800c7266a2be04c571c04d5a6614691ea99bd");
+ Assert.Equal(newMergedCommit.Parents.Skip(1).First().Sha, "9fd738e8f7967c078dceed8190330fc8648ee56a");
+ }
+ }
+
+ [Fact]
public void CommitCleansUpMergeMetadata()
{
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();