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>2014-04-09 19:19:06 +0400
committerEdward Thomson <ethomson@microsoft.com>2014-04-09 21:00:52 +0400
commitbd85a5b8557e27105d6476c83486516c73b95cd9 (patch)
treebb996ab1277b2cd13857a91d241ad58930c4022c /LibGit2Sharp.Tests/CommitFixture.cs
parent8a303f2b24a053816d8d88c3733447ae5565e662 (diff)
Introduce CommitOptions
Repository#Commit (and its extension methods) now take CommitOptions. All prior methods are deprecated.
Diffstat (limited to 'LibGit2Sharp.Tests/CommitFixture.cs')
-rw-r--r--LibGit2Sharp.Tests/CommitFixture.cs27
1 files changed, 18 insertions, 9 deletions
diff --git a/LibGit2Sharp.Tests/CommitFixture.cs b/LibGit2Sharp.Tests/CommitFixture.cs
index c34bd4bb..e372fd7d 100644
--- a/LibGit2Sharp.Tests/CommitFixture.cs
+++ b/LibGit2Sharp.Tests/CommitFixture.cs
@@ -752,7 +752,8 @@ namespace LibGit2Sharp.Tests
CreateAndStageANewFile(repo);
- Commit amendedCommit = repo.Commit("I'm rewriting the history!", Constants.Signature, Constants.Signature, true);
+ Commit amendedCommit = repo.Commit("I'm rewriting the history!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AmendPreviousCommit = true });
Assert.Equal(1, repo.Head.Commits.Count());
@@ -775,7 +776,8 @@ namespace LibGit2Sharp.Tests
CreateAndStageANewFile(repo);
const string commitMessage = "I'm rewriting the history!";
- Commit amendedCommit = repo.Commit(commitMessage, Constants.Signature, Constants.Signature, true);
+ Commit amendedCommit = repo.Commit(commitMessage, Constants.Signature, Constants.Signature,
+ new CommitOptions { AmendPreviousCommit = true });
AssertCommitHasBeenAmended(repo, amendedCommit, mergedCommit);
@@ -810,7 +812,8 @@ namespace LibGit2Sharp.Tests
using (var repo = new Repository(repoPath))
{
- Assert.Throws<UnbornBranchException>(() => repo.Commit("I can not amend anything !:(", Constants.Signature, Constants.Signature, true));
+ Assert.Throws<UnbornBranchException>(() =>
+ repo.Commit("I can not amend anything !:(", Constants.Signature, Constants.Signature, new CommitOptions { AmendPreviousCommit = true }));
}
}
@@ -908,7 +911,8 @@ namespace LibGit2Sharp.Tests
repo.Reset(ResetMode.Hard);
repo.RemoveUntrackedFiles();
- repo.Commit("Empty commit!", Constants.Signature, Constants.Signature, false, true);
+ repo.Commit("Empty commit!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AllowEmptyCommit = true });
}
}
@@ -921,9 +925,11 @@ namespace LibGit2Sharp.Tests
repo.Reset(ResetMode.Hard);
repo.RemoveUntrackedFiles();
- repo.Commit("Empty commit!", Constants.Signature, Constants.Signature, false, true);
+ repo.Commit("Empty commit!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AllowEmptyCommit = true });
- Assert.Throws<EmptyCommitException>(() => repo.Commit("Empty commit!", Constants.Signature, Constants.Signature, true, false));
+ Assert.Throws<EmptyCommitException>(() => repo.Commit("Empty commit!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AmendPreviousCommit = true }));
}
}
@@ -936,9 +942,11 @@ namespace LibGit2Sharp.Tests
repo.Reset(ResetMode.Hard);
repo.RemoveUntrackedFiles();
- Commit emptyCommit = repo.Commit("Empty commit!", Constants.Signature, Constants.Signature, false, true);
+ Commit emptyCommit = repo.Commit("Empty commit!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AllowEmptyCommit = true });
- Commit amendedCommit = repo.Commit("I'm rewriting the history!", Constants.Signature, Constants.Signature, true, true);
+ Commit amendedCommit = repo.Commit("I'm rewriting the history!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AmendPreviousCommit = true, AllowEmptyCommit = true });
AssertCommitHasBeenAmended(repo, amendedCommit, emptyCommit);
}
}
@@ -976,7 +984,8 @@ namespace LibGit2Sharp.Tests
Touch(repo.Info.Path, "MERGE_HEAD", "f705abffe7015f2beacf2abe7a36583ebee3487e\n");
Commit newMergedCommit = repo.Commit("Merge commit", Constants.Signature, Constants.Signature);
- Commit amendedCommit = repo.Commit("I'm rewriting the history!", Constants.Signature, Constants.Signature, true);
+ Commit amendedCommit = repo.Commit("I'm rewriting the history!", Constants.Signature, Constants.Signature,
+ new CommitOptions { AmendPreviousCommit = true });
AssertCommitHasBeenAmended(repo, amendedCommit, newMergedCommit);
}
}