diff options
Diffstat (limited to 'LibGit2Sharp.Tests')
-rw-r--r-- | LibGit2Sharp.Tests/RepositoryOptionsFixture.cs | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs b/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs index 0a816bc7..946d4a31 100644 --- a/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs +++ b/LibGit2Sharp.Tests/RepositoryOptionsFixture.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Linq; using System.Text; using LibGit2Sharp.Tests.TestHelpers; using Xunit; @@ -174,5 +175,31 @@ namespace LibGit2Sharp.Tests AssertValueInConfigFile(systemLocation, "xpaulbettsx"); } + + [Fact] + public void CanCommitOnBareRepository() + { + string repoPath = InitNewRepository(true); + SelfCleaningDirectory scd = BuildSelfCleaningDirectory(); + string workPath = Path.Combine(scd.RootedDirectoryPath, "work"); + Directory.CreateDirectory(workPath); + + var repositoryOptions = new RepositoryOptions + { + WorkingDirectoryPath = workPath, + IndexPath = Path.Combine(scd.RootedDirectoryPath, "index") + }; + + using (var repo = new Repository(repoPath, repositoryOptions)) + { + const string relativeFilepath = "test.txt"; + Touch(repo.Info.WorkingDirectory, relativeFilepath, "test\n"); + repo.Index.Stage(relativeFilepath); + + Assert.NotNull(repo.Commit("Initial commit", Constants.Signature, Constants.Signature)); + Assert.Equal(1, repo.Head.Commits.Count()); + Assert.Equal(1, repo.Commits.Count()); + } + } } } |