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:
authornulltoken <emeric.fermas@gmail.com>2012-04-21 23:37:24 +0400
committernulltoken <emeric.fermas@gmail.com>2012-04-28 05:32:19 +0400
commit2401133ef6f365d3aae26a020f2754584852e558 (patch)
treeea01f38dbcd56ca75304e04d1aafcbe11fa0ef11 /LibGit2Sharp.Tests
parenta3d5b885eeb3d1fac1bf69c95196e7d8ef167e28 (diff)
Add Repository.ObjectDatabase.CreateCommit()
Partially fixes #127.
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r--LibGit2Sharp.Tests/ObjectDatabaseFixture.cs23
1 files changed, 23 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs b/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs
index f7b83f42..5102f616 100644
--- a/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs
+++ b/LibGit2Sharp.Tests/ObjectDatabaseFixture.cs
@@ -182,5 +182,28 @@ namespace LibGit2Sharp.Tests
Assert.Equal("dc53d4c6b8684c21b0b57db29da4a2afea011565", td["1/2/another new file"].TargetId.Sha);
}
}
+
+ [Fact]
+ public void CanCreateACommit()
+ {
+ TemporaryCloneOfTestRepo scd = BuildTemporaryCloneOfTestRepo();
+
+ using (var repo = new Repository(scd.RepositoryPath))
+ {
+ Branch head = repo.Head;
+
+ TreeDefinition td = TreeDefinition.From(repo.Head.Tip.Tree);
+ td.Add("1/2/readme", td["README"]);
+
+ Tree tree = repo.ObjectDatabase.CreateTree(td);
+
+ 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));
+ }
+ }
}
}