diff options
Diffstat (limited to 'LibGit2Sharp/Repository.cs')
-rw-r--r-- | LibGit2Sharp/Repository.cs | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/LibGit2Sharp/Repository.cs b/LibGit2Sharp/Repository.cs index 4e06ea6f..54707803 100644 --- a/LibGit2Sharp/Repository.cs +++ b/LibGit2Sharp/Repository.cs @@ -386,6 +386,48 @@ namespace LibGit2Sharp } /// <summary> + /// Try to lookup an object by its <see cref = "ObjectId" />. If no matching object is found, null will be returned. + /// </summary> + /// <param name = "id">The id to lookup.</param> + /// <returns>The <see cref = "GitObject" /> or null if it was not found.</returns> + public GitObject Lookup(ObjectId id) + { + return LookupInternal(id, GitObjectType.Any, null); + } + + /// <summary> + /// Try to lookup an object by its sha or a reference canonical name. If no matching object is found, null will be returned. + /// </summary> + /// <param name = "objectish">A revparse spec for the object to lookup.</param> + /// <returns>The <see cref = "GitObject" /> or null if it was not found.</returns> + public GitObject Lookup(string objectish) + { + return Lookup(objectish, GitObjectType.Any, LookUpOptions.None); + } + + /// <summary> + /// Try to lookup an object by its <see cref = "ObjectId" /> and <see cref = "GitObjectType" />. If no matching object is found, null will be returned. + /// </summary> + /// <param name = "id">The id to lookup.</param> + /// <param name = "type">The kind of GitObject being looked up</param> + /// <returns>The <see cref = "GitObject" /> or null if it was not found.</returns> + public GitObject Lookup(ObjectId id, ObjectType type) + { + return LookupInternal(id, type.ToGitObjectType(), null); + } + + /// <summary> + /// Try to lookup an object by its sha or a reference canonical name and <see cref = "GitObjectType" />. If no matching object is found, null will be returned. + /// </summary> + /// <param name = "objectish">A revparse spec for the object to lookup.</param> + /// <param name = "type">The kind of <see cref = "GitObject" /> being looked up</param> + /// <returns>The <see cref = "GitObject" /> or null if it was not found.</returns> + public GitObject Lookup(string objectish, ObjectType type) + { + return Lookup(objectish, type.ToGitObjectType(), LookUpOptions.None); + } + + /// <summary> /// Try to lookup an object by its <see cref = "ObjectId" /> and <see cref = "GitObjectType" />. If no matching object is found, null will be returned. /// </summary> /// <param name = "id">The id to lookup.</param> |