diff options
author | nulltoken <emeric.fermas@gmail.com> | 2013-04-30 23:59:03 +0400 |
---|---|---|
committer | nulltoken <emeric.fermas@gmail.com> | 2013-05-03 22:06:34 +0400 |
commit | 82a8d05417dc804c114376140be94ae69e3c5af4 (patch) | |
tree | 51849360ff3c554af7aff84311db2d8e3fee394b /LibGit2Sharp/ObjectType.cs | |
parent | b4aae4b72586a64159a1f8f10bdf7787d091d3fa (diff) |
Introduce ObjectType
Diffstat (limited to 'LibGit2Sharp/ObjectType.cs')
-rw-r--r-- | LibGit2Sharp/ObjectType.cs | 54 |
1 files changed, 54 insertions, 0 deletions
diff --git a/LibGit2Sharp/ObjectType.cs b/LibGit2Sharp/ObjectType.cs new file mode 100644 index 00000000..efe4e251 --- /dev/null +++ b/LibGit2Sharp/ObjectType.cs @@ -0,0 +1,54 @@ +using System; + +namespace LibGit2Sharp +{ + /// <summary> + /// Underlying type of a <see cref = "GitObject" /> + /// </summary> + public enum ObjectType + { + /// <summary> + /// A commit object. + /// </summary> + Commit = 1, + + /// <summary> + /// A tree (directory listing) object. + /// </summary> + Tree = 2, + + /// <summary> + /// A file revision object. + /// </summary> + Blob = 3, + + /// <summary> + /// An annotated tag object. + /// </summary> + 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("Cannot map {0} to a GitObjectType.", type)); + } + } + } +} |