diff options
author | Russell Belfer <rb@github.com> | 2012-08-27 22:53:59 +0400 |
---|---|---|
committer | Russell Belfer <rb@github.com> | 2012-08-27 22:53:59 +0400 |
commit | d8057a5b0ed644b1f72a4eb80f82da7ce8977958 (patch) | |
tree | 43c962073e49ff204f92345a2d0713bb56a56ffd /src/tag.c | |
parent | 2b175ca972f2531e5ef46d24abeb831d90033a33 (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.c | 17 |
1 files changed, 1 insertions, 16 deletions
@@ -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); } |