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>2012-08-27 22:53:59 +0400
committerRussell Belfer <rb@github.com>2012-08-27 22:53:59 +0400
commitd8057a5b0ed644b1f72a4eb80f82da7ce8977958 (patch)
tree43c962073e49ff204f92345a2d0713bb56a56ffd /src/tag.c
parent2b175ca972f2531e5ef46d24abeb831d90033a33 (diff)
Make git_object_peel a bit smarter
This expands the types of peeling that `git_object_peel` knows how to do to include TAG -> BLOB peeling, and makes the errors slightly more consistent depending on the situation. It also adds a new special behavior where peeling to ANY will peel until the object type changes (e.g. chases TAGs to a non-TAG). Using this expanded peeling, this replaces peeling code that was embedded in `git_tag_peel` and `git_reset`.
Diffstat (limited to 'src/tag.c')
-rw-r--r--src/tag.c17
1 files changed, 1 insertions, 16 deletions
diff --git a/src/tag.c b/src/tag.c
index 463619f63..6495d470f 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -445,20 +445,5 @@ int git_tag_list(git_strarray *tag_names, git_repository *repo)
int git_tag_peel(git_object **tag_target, git_tag *tag)
{
- int error;
- git_object *target;
-
- assert(tag_target && tag);
-
- if (git_tag_target(&target, tag) < 0)
- return -1;
-
- if (git_object_type(target) == GIT_OBJ_TAG) {
- error = git_tag_peel(tag_target, (git_tag *)target);
- git_object_free(target);
- return error;
- }
-
- *tag_target = target;
- return 0;
+ return git_object_peel(tag_target, (git_object *)tag, GIT_OBJ_ANY);
}