Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/libgit2.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src/tag.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-04-16 22:51:02 +0400
committerVicent Marti <tanoku@gmail.com>2013-04-22 18:52:06 +0400
commit3f27127d15dfe69943d3c9ddf96d09a2300de3a9 (patch)
tree77970a2d28265f4d4319f6613aff4a6501d57c12 /src/tag.c
parent786062639f05e361da977f3f1f6286141fa12fca (diff)
Simplify object table parse functions
This unifies the object parse functions into one signature that takes an odb_object.
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c38
1 files changed, 23 insertions, 15 deletions
diff --git a/src/tag.c b/src/tag.c
index 7dadc7e60..b9a806cd1 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -70,13 +70,12 @@ static int tag_error(const char *str)
return -1;
}
-int git_tag__parse(void *_tag, const char *buffer, const char *buffer_end)
+static int tag_parse(git_tag *tag, const char *buffer, const char *buffer_end)
{
static const char *tag_types[] = {
NULL, "commit\n", "tree\n", "blob\n", "tag\n"
};
- git_tag *tag = _tag;
unsigned int i;
size_t text_len;
char *search;
@@ -157,6 +156,15 @@ int git_tag__parse(void *_tag, const char *buffer, const char *buffer_end)
return 0;
}
+int git_tag__parse(void *_tag, git_odb_object *odb_obj)
+{
+ git_tag *tag = _tag;
+ const char *buffer = git_odb_object_data(odb_obj);
+ const char *buffer_end = buffer + git_odb_object_size(odb_obj);
+
+ return tag_parse(tag, buffer, buffer_end);
+}
+
static int retrieve_tag_reference(
git_reference **tag_reference_out,
git_buf *ref_name_out,
@@ -277,23 +285,23 @@ cleanup:
}
int git_tag_create(
- git_oid *oid,
- git_repository *repo,
- const char *tag_name,
- const git_object *target,
- const git_signature *tagger,
- const char *message,
- int allow_ref_overwrite)
+ git_oid *oid,
+ git_repository *repo,
+ const char *tag_name,
+ const git_object *target,
+ const git_signature *tagger,
+ const char *message,
+ int allow_ref_overwrite)
{
return git_tag_create__internal(oid, repo, tag_name, target, tagger, message, allow_ref_overwrite, 1);
}
int git_tag_create_lightweight(
- git_oid *oid,
- git_repository *repo,
- const char *tag_name,
- const git_object *target,
- int allow_ref_overwrite)
+ git_oid *oid,
+ git_repository *repo,
+ const char *tag_name,
+ const git_object *target,
+ int allow_ref_overwrite)
{
return git_tag_create__internal(oid, repo, tag_name, target, NULL, NULL, allow_ref_overwrite, 0);
}
@@ -317,7 +325,7 @@ int git_tag_create_frombuffer(git_oid *oid, git_repository *repo, const char *bu
return -1;
/* validate the buffer */
- if (git_tag__parse(&tag, buffer, buffer + strlen(buffer)) < 0)
+ if (tag_parse(&tag, buffer, buffer + strlen(buffer)) < 0)
return -1;
/* validate the target */