libgit2/libgit2sharp — pull request #266 by jamill (2012-12-05 20:36:47+00:00)
Title: Fix IsTracking Property for DetachedHead branches

Accessing the IsTracking property (and any property that accessing IsTracking internally) throws an exception. This fix is to have the DetachedHead always return false for IsTracking.

Here is the failure before the fix:

LibGit2Sharp.Tests.BranchFixture.DetachedHeadIsNotATrackingBranch [FAIL]
LibGit2Sharp.LibGit2SharpException : An error was raised by libgit2. Category = Reference (-12). The given reference name '(no branch)' is not valid

Stack Trace:

libgit2sharp\LibGit2Sharp\Core\Ensure.cs(85,0): at LibGit2Sharp.Core.Ensure.Success(Int32 result, Boolean allowPositiveResult)
libgit2sharp\LibGit2Sharp\Core\Proxy.cs(1020,0): at LibGit2Sharp.Core.Proxy.git_reference_lookup(RepositorySafeHandle repo, String name, Boolean shouldThrowIfNotFound)
libgit2sharp\LibGit2Sharp\ReferenceCollection.cs(227,0): at LibGit2Sharp.ReferenceCollection.RetrieveReferencePtr(String referenceName, Boolean shouldThrowIfNotFound)
libgit2sharp\LibGit2Sharp\Branch.cs(204,0): at LibGit2Sharp.Branch.ResolveTrackedBranch()
libgit2sharp\LibGit2Sharp\Core\Compat\Lazy.cs(45,0): at LibGit2Sharp.Core.Compat.Lazy`1.Evaluate()
libgit2sharp\LibGit2Sharp\Core\Compat\Lazy.cs(34,0): at LibGit2Sharp.Core.Compat.Lazy`1.get_Value()
libgit2sharp\LibGit2Sharp\Branch.cs(88,0): at LibGit2Sharp.Branch.get_TrackedBranch()
libgit2sharp\LibGit2Sharp\Branch.cs(96,0): at LibGit2Sharp.Branch.get_IsTracking()
libgit2sharp\LibGit2Sharp.Tests\BranchFixture.cs(596,0): at LibGit2Sharp.Tests.BranchFixture.DetachedHeadIsNotATrackingBranch()