summaryrefslogtreecommitdiff
path: root/src/git
diff options
context:
space:
mode:
authorVicent Marti <tanoku@gmail.com>2010-08-07 01:02:20 +0200
committerVicent Marti <tanoku@gmail.com>2010-08-12 04:40:43 +0200
commitf8758044876b30b0f6482d1fe8c3b1de743f4186 (patch)
tree95dd9fd8cb6b7c2acf97acdbbc436d7dbb7a3fbc /src/git
parent364788e1d114a174dd3c6fdfd3aa16d9627551b2 (diff)
downloadlibgit2-f8758044876b30b0f6482d1fe8c3b1de743f4186.tar.gz
Add loading and parsing of tag objects
Tag objects are now properly loaded from the revision pool. New test t0801 checks for loading a parsing a series of tags, including the tag of a tag. Signed-off-by: Vicent Marti <tanoku@gmail.com>
Diffstat (limited to 'src/git')
-rw-r--r--src/git/tag.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/git/tag.h b/src/git/tag.h
new file mode 100644
index 000000000..509d2f047
--- /dev/null
+++ b/src/git/tag.h
@@ -0,0 +1,89 @@
+#ifndef INCLUDE_git_tag_h__
+#define INCLUDE_git_tag_h__
+
+#include "common.h"
+#include "oid.h"
+#include "tree.h"
+
+/**
+ * @file git/tag.h
+ * @brief Git tag parsing routines
+ * @defgroup git_tag Git tag management
+ * @ingroup Git
+ * @{
+ */
+GIT_BEGIN_DECL
+
+/** Parsed representation of a tag object. */
+typedef struct git_tag git_tag;
+
+/**
+ * Locate a reference to a tag without loading it.
+ * The generated tag object is owned by the revision
+ * pool and shall not be freed by the user.
+ *
+ * @param pool the pool to use when locating the tag.
+ * @param id identity of the tag to locate.
+ * @return the tag; NULL if the tag could not be created
+ */
+GIT_EXTERN(git_tag *) git_tag_lookup(git_revpool *pool, const git_oid *id);
+
+/**
+ * Locate a reference to a tag, and try to load and parse it it from
+ * the object cache or the object database.
+ * The generated tag object is owned by the revision
+ * pool and shall not be freed by the user.
+ *
+ * @param pool the pool to use when parsing/caching the tag.
+ * @param id identity of the tag to locate.
+ * @return the tag; NULL if the tag does not exist in the
+ * pool's git_odb, or if the tag is present but is
+ * too malformed to be parsed successfully.
+ */
+GIT_EXTERN(git_tag *) git_tag_parse(git_revpool *pool, const git_oid *id);
+
+/**
+ * Get the id of a tag.
+ * @param tag a previously loaded tag.
+ * @return object identity for the tag.
+ */
+GIT_EXTERN(const git_oid *) git_tag_id(git_tag *tag);
+
+/**
+ * Get the tagged object of a tag
+ * @param tag a previously loaded tag.
+ * @return reference to a repository object
+ */
+GIT_EXTERN(const git_repository_object *) git_tag_target(git_tag *t);
+
+/**
+ * Get the type of a tag's tagged object
+ * @param tag a previously loaded tag.
+ * @return type of the tagged object
+ */
+GIT_EXTERN(git_otype) git_tag_type(git_tag *t);
+
+/**
+ * Get the name of a tag
+ * @param tag a previously loaded tag.
+ * @return name of the tag
+ */
+GIT_EXTERN(const char *) git_tag_name(git_tag *t);
+
+/**
+ * Get the tagger (author) of a tag
+ * @param tag a previously loaded tag.
+ * @return reference to the tag's author
+ */
+GIT_EXTERN(const git_person *) git_tag_tagger(git_tag *t);
+
+/**
+ * Get the message of a tag
+ * @param tag a previously loaded tag.
+ * @return message of the tag
+ */
+GIT_EXTERN(const char *) git_tag_message(git_tag *t);
+
+/** @} */
+GIT_END_DECL
+#endif