]> git.proxmox.com Git - libgit2.git/commitdiff
Tags: teach git_tag_list not to include the 'refs/tags/' prefix
authorSascha Cunz <Sascha@BabbelBox.org>
Thu, 20 Sep 2012 20:42:22 +0000 (22:42 +0200)
committerSascha Cunz <Sascha@BabbelBox.org>
Sat, 22 Sep 2012 21:12:03 +0000 (23:12 +0200)
Since quite a while now, git_branch_foreach has learnt to list branches
without the 'refs/heads/' or 'refs/remotes' prefixes.
This patch teaches git_tag_list to do the same for listing tags.

src/tag.c

index 6495d470f01e6338f5de40b5696e6039ff5b86ed..ae9d0a895e442441082aa2f35001fe479d01bf41 100644 (file)
--- a/src/tag.c
+++ b/src/tag.c
@@ -408,7 +408,7 @@ static int tag_list_cb(const char *tag_name, void *payload)
 
        filter = (tag_filter_data *)payload;
        if (!*filter->pattern || p_fnmatch(filter->pattern, tag_name + GIT_REFS_TAGS_DIR_LEN, 0) == 0)
-               return git_vector_insert(filter->taglist, git__strdup(tag_name));
+               return git_vector_insert(filter->taglist, git__strdup(tag_name + GIT_REFS_TAGS_DIR_LEN));
 
        return 0;
 }