using System; using System.Globalization; using LibGit2Sharp.Core; namespace LibGit2Sharp { /// /// Underlying type of a /// public enum ObjectType { /// /// A commit object. /// Commit = 1, /// /// A tree (directory listing) object. /// Tree = 2, /// /// A file revision object. /// Blob = 3, /// /// An annotated tag object. /// Tag = 4, } internal static class ObjectTypeExtensions { public static GitObjectType ToGitObjectType(this ObjectType type) { switch (type) { case ObjectType.Commit: return GitObjectType.Commit; case ObjectType.Tree: return GitObjectType.Tree; case ObjectType.Blob: return GitObjectType.Blob; case ObjectType.Tag: return GitObjectType.Tag; default: throw new InvalidOperationException( string.Format(CultureInfo.InvariantCulture, "Cannot map {0} to a GitObjectType.", type)); } } } }