diff options
author | nulltoken <emeric.fermas@gmail.com> | 2011-05-14 21:09:59 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2011-05-15 00:29:50 +0400 |
commit | 23bb3576abaf03847ffff1fad97e5d4c1de5663c (patch) | |
tree | 4f1b775b1ddaf49e3af9d53bb9cfc2a04ac9bcfd /LibGit2Sharp/Reference.cs | |
parent | 5a47dc45363e078db0f701384c820c27d6ec2548 (diff) |
Update libgit2 binaries to f02f4b5
Fix implementation to cope with improved reference resolving.
Diffstat (limited to 'LibGit2Sharp/Reference.cs')
-rw-r--r-- | LibGit2Sharp/Reference.cs | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/LibGit2Sharp/Reference.cs b/LibGit2Sharp/Reference.cs index d37cb944..ec71e7e7 100644 --- a/LibGit2Sharp/Reference.cs +++ b/LibGit2Sharp/Reference.cs @@ -18,6 +18,7 @@ namespace LibGit2Sharp /// </summary> public string CanonicalName { get; protected set; } + //TODO: Cries for refactoring. internal static T BuildFromPtr<T>(IntPtr ptr, Repository repo) where T : class { if (ptr == IntPtr.Zero) @@ -35,7 +36,16 @@ namespace LibGit2Sharp case GitReferenceType.Symbolic: IntPtr resolveRef; var targetName = NativeMethods.git_reference_target(ptr); - NativeMethods.git_reference_resolve(out resolveRef, ptr); + int res = NativeMethods.git_reference_resolve(out resolveRef, ptr); + + if (res == (int) GitErrorCode.GIT_ENOTFOUND) + { + reference = new SymbolicReference { CanonicalName = name, Target = null, TargetIdentifier = targetName }; + break; + } + + Ensure.Success(res); + var targetRef = BuildFromPtr<Reference>(resolveRef, repo); reference = new SymbolicReference { CanonicalName = name, Target = targetRef, TargetIdentifier = targetName}; break; |