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:28:17 +0400
committernulltoken <emeric.fermas@gmail.com>2013-01-29 02:08:33 +0400
commit742f5b831469932a2c3af645d3d8d8c0f506950e (patch)
tree6d1e7146c755699604fb0b32f24b36d47f98eb53 /LibGit2Sharp.Tests/CommitFixture.cs
parent9cfc8f36d4ef3ee7a66d4d03fb1ac46cb16f4f3f (diff)
Teach Repository.Commit() to cleanup merge data
Diffstat (limited to 'LibGit2Sharp.Tests/CommitFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/CommitFixture.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs
index 6cbb6670..ef101176 100644
--- a/LibGit2Sharp.Tests/CommitFixture.cs
+++ b/LibGit2Sharp.Tests/CommitFixture.cs
@@ -528,6 +528,48 @@ namespace LibGit2Sharp.Tests
}
[Fact]
+ public void CommitCleansUpMergeMetadata()
+ {
+ SelfCleaningDirectory scd = BuildSelfCleaningDirectory();
+
+ using (var repo = Repository.Init(scd.DirectoryPath))
+ {
+ string dir = repo.Info.Path;
+ Assert.True(Path.IsPathRooted(dir));
+ Assert.True(Directory.Exists(dir));
+
+ const string relativeFilepath = "new.txt";
+ string filePath = Path.Combine(repo.Info.WorkingDirectory, relativeFilepath);
+
+ File.WriteAllText(filePath, "this is a new file");
+ repo.Index.Stage(relativeFilepath);
+
+ string mergeHeadPath = Path.Combine(repo.Info.Path, "MERGE_HEAD");
+ string mergeMsgPath = Path.Combine(repo.Info.Path, "MERGE_MSG");
+ string mergeModePath = Path.Combine(repo.Info.Path, "MERGE_MODE");
+ string origHeadPath = Path.Combine(repo.Info.Path, "ORIG_HEAD");
+
+ File.WriteAllText(mergeHeadPath, "abcdefabcdefabcdefabcdefabcdefabcdefabcd");
+ File.WriteAllText(mergeMsgPath, "This is a dummy merge.\n");
+ File.WriteAllText(mergeModePath, "no-ff");
+ File.WriteAllText(origHeadPath, "beefbeefbeefbeefbeefbeefbeefbeefbeefbeef");
+
+ Assert.True(File.Exists(mergeHeadPath));
+ Assert.True(File.Exists(mergeMsgPath));
+ Assert.True(File.Exists(mergeModePath));
+ Assert.True(File.Exists(origHeadPath));
+
+ var author = DummySignature;
+ repo.Commit("Initial egotistic commit", author, author);
+
+ Assert.False(File.Exists(mergeHeadPath));
+ Assert.False(File.Exists(mergeMsgPath));
+ Assert.False(File.Exists(mergeModePath));
+ Assert.True(File.Exists(origHeadPath));
+ }
+ }
+
+ [Fact]
public void CanCommitALittleBit()
{
SelfCleaningDirectory scd = BuildSelfCleaningDirectory();