Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doc author, committer, message #23062

Merged
merged 1 commit into from
Aug 1, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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