libgit2 - get all the files of a tag

16 Views Asked by At

As I understood, in Git, a tag is just a reference to a commit, right? But a commit doesn't contain all the files at that moment, just the modified ones.

What I would like to achieve is, having the tag's name, to get all files at that moment.

So, I am using this code to get the tag names:

    git_repository *repository;
    int error = git_repository_open(&repository, path);
    checkError(error_buffer, error);
    git_strarray tag_names = {nullptr};
    git_tag_list(&tag_names, repository);
    size_t i;
    if(tag_names.count){
        for(i = 0; i < tag_names.count; i++) {
            rv.emplace_back(tag_names.strings[i]);
        }
        git_strarray_dispose(&tag_names);
    }
    git_repository_free(repository);

KI

0

There are 0 best solutions below