Skip to content

Commit

Permalink
Doc author, committer, message (#23062)
Browse files Browse the repository at this point in the history
  • Loading branch information
kshyatt authored and ararslan committed Aug 1, 2017
1 parent 9b397fa commit fb76529
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
22 changes: 22 additions & 0 deletions base/libgit2/commit.jl
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

"""
message(c::GitCommit, raw::Bool=false)
Return the commit message describing the changes made in commit `c`. If
`raw` is `false`, return a slightly "cleaned up" message (which has any
leading newlines removed). If `raw` is `true`, the message is not stripped
of any such newlines.
"""
function message(c::GitCommit, raw::Bool=false)
local msg_ptr::Cstring
msg_ptr = raw ? ccall((:git_commit_message_raw, :libgit2), Cstring, (Ptr{Void},), c.ptr) :
Expand All @@ -10,12 +18,26 @@ function message(c::GitCommit, raw::Bool=false)
return unsafe_string(msg_ptr)
end

"""
author(c::GitCommit)
Return the [`Signature`](@ref) of the author of the commit `c`. The author is
the person who made changes to the relevant file(s). See also [`committer`](@ref).
"""
function author(c::GitCommit)
ptr = ccall((:git_commit_author, :libgit2), Ptr{SignatureStruct}, (Ptr{Void},), c.ptr)
@assert ptr != C_NULL
return Signature(ptr)
end

"""
committer(c::GitCommit)
Return the [`Signature`](@ref) of the committer of the commit `c`. The committer is
the person who committed the changes originally authored by the [`author`](@ref), but
need not be the same as the `author`, for example, if the `author` emailed a patch to
a `committer` who committed it.
"""
function committer(c::GitCommit)
ptr = ccall((:git_commit_committer, :libgit2), Ptr{SignatureStruct}, (Ptr{Void},), c.ptr)
@assert ptr != C_NULL
Expand Down
3 changes: 3 additions & 0 deletions doc/src/devdocs/libgit2.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,15 @@ Base.LibGit2.UserPasswordCredentials
Base.LibGit2.add_fetch!
Base.LibGit2.add_push!
Base.LibGit2.addblob!
Base.LibGit2.author
Base.LibGit2.authors
Base.LibGit2.branch
Base.LibGit2.branch!
Base.LibGit2.checkout!
Base.LibGit2.checkused!
Base.LibGit2.clone
Base.LibGit2.commit
Base.LibGit2.committer
Base.LibGit2.create_branch
Base.LibGit2.credentials_callback
Base.LibGit2.credentials_cb
Expand Down Expand Up @@ -88,6 +90,7 @@ Base.LibGit2.isorphan
Base.LibGit2.lookup_branch
Base.LibGit2.mirror_callback
Base.LibGit2.mirror_cb
Base.LibGit2.message
Base.LibGit2.name
Base.LibGit2.need_update
Base.LibGit2.objtype
Expand Down

0 comments on commit fb76529

Please sign in to comment.