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:
authorKeith Dahlby <dahlbyk@gmail.com>2012-12-19 08:02:42 +0400
committernulltoken <emeric.fermas@gmail.com>2013-01-29 02:08:52 +0400
commitaa5d87d0261aa6339910c4d9588122a6ee9d4458 (patch)
tree391002ebd4c0fb7328deeee0ec57a21c708d077a
parent51d0754a90aad8d38e5e43624c5ded4363198751 (diff)
Enhance Branch.TrackedBranch test coverage
-rw-r--r--LibGit2Sharp.Tests/BranchFixture.cs32
1 files changed, 32 insertions, 0 deletions
diff --git a/LibGit2Sharp.Tests/BranchFixture.cs b/LibGit2Sharp.Tests/BranchFixture.cs
index 34155144..9804bfa0 100644
--- a/LibGit2Sharp.Tests/BranchFixture.cs
+++ b/LibGit2Sharp.Tests/BranchFixture.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Linq;
using LibGit2Sharp.Tests.TestHelpers;
using Xunit;
@@ -605,6 +606,37 @@ namespace LibGit2Sharp.Tests
}
[Fact]
+ public void TrackedBranchExistsFromDefaultConfigInEmptyClone()
+ {
+ SelfCleaningDirectory scd1 = BuildSelfCleaningDirectory();
+
+ Uri uri;
+ using (var emptyRepo = Repository.Init(scd1.DirectoryPath, true))
+ {
+ uri = new Uri(emptyRepo.Info.Path);
+ }
+
+ SelfCleaningDirectory scd2 = BuildSelfCleaningDirectory();
+ using (Repository repo = Repository.Clone(uri.AbsoluteUri, scd2.RootedDirectoryPath))
+ {
+ Assert.Empty(Directory.GetFiles(scd2.RootedDirectoryPath));
+ Assert.Equal(repo.Head.Name, "master");
+ Assert.Null(repo.Head.Tip);
+ Assert.NotNull(repo.Head.TrackedBranch);
+
+ Assert.NotNull(repo.Head.Remote);
+ Assert.Equal("origin", repo.Head.Remote.Name);
+
+ File.WriteAllText(Path.Combine(scd2.RootedDirectoryPath, "a.txt"), "a");
+ repo.Index.Stage("a.txt");
+ repo.Commit("A file", DummySignature, DummySignature);
+
+ Assert.NotNull(repo.Head.Tip);
+ Assert.NotNull(repo.Head.TrackedBranch);
+ }
+ }
+
+ [Fact]
public void RemoteBranchesDoNotTrackAnything()
{
using (var repo = new Repository(StandardTestRepoPath))