Skip to content

Commit

Permalink
More docs for tags
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt committed Feb 8, 2017
1 parent cd6beb9 commit 33b725a
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions base/libgit2/tag.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# This file is a part of Julia. License is MIT: http://julialang.org/license

"""
LibGit2.tag_list(repo::GitRepo) -> Vector{String}
Get a list of all tags in the git repository `repo`.
"""
function tag_list(repo::GitRepo)
sa_ref = Ref(StrArrayStruct())
@check ccall((:git_tag_list, :libgit2), Cint,
Expand All @@ -9,11 +14,27 @@ function tag_list(repo::GitRepo)
res
end

"""
LibGit2.tag_delete(repo::GitRepo, tag::AbstractString)
Remove the git tag `tag` from the repository `repo`.
"""
function tag_delete(repo::GitRepo, tag::AbstractString)
@check ccall((:git_tag_delete, :libgit2), Cint,
(Ptr{Void}, Cstring, ), repo.ptr, tag)
end

"""
LibGit2.tag_create(repo::GitRepo, tag::AbstractString, commit; kwargs...)
Create a new git tag `tag` (e.g. `"v0.5"`) in the repository `repo`, at
the commit `commit`.
The keyword arguments are:
* `msg::AbstractString=""`: the message for the tag.
* `force::Bool=false`: if `true`, existing references will be overwritten.
* `sig::Signature=Signature(repo)`: the tagger's signature.
"""
function tag_create(repo::GitRepo, tag::AbstractString, commit::Union{AbstractString,AbstractGitHash};
msg::AbstractString = "",
force::Bool = false,
Expand All @@ -30,6 +51,11 @@ function tag_create(repo::GitRepo, tag::AbstractString, commit::Union{AbstractSt
return oid_ptr[]
end

"""
LibGit2.name(tag::GitTag)
The name of `tag` (e.g. `"v0.5"`).
"""
function name(tag::GitTag)
str_ptr = ccall((:git_tag_name, :libgit2), Cstring, (Ptr{Void}, ), tag.ptr)
str_ptr == C_NULL && throw(Error.GitError(Error.ERROR))
Expand Down

0 comments on commit 33b725a

Please sign in to comment.