Skip to content

Commit bad1329

Browse files
authored
Merge pull request #23538 from JuliaLang/ksh/doccommit
Add docs for internal commit method
2 parents 99173bb + e0ca7d0 commit bad1329

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

base/libgit2/commit.jl

+19-2
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ function Base.show(io::IO, c::GitCommit)
5050
print(io, "Git Commit:\nCommit Author: $authstr\nCommitter: $cmtrstr\nSHA: $(GitHash(c))\nMessage:\n$(message(c))")
5151
end
5252

53-
""" Wrapper around `git_commit_create` """
5453
function commit(repo::GitRepo,
5554
refname::AbstractString,
5655
msg::AbstractString,
@@ -73,7 +72,25 @@ function commit(repo::GitRepo,
7372
return commit_id_ptr[]
7473
end
7574

76-
"""Commit changes to repository"""
75+
"""
76+
commit(repo::GitRepo, msg::AbstractString; kwargs...) -> GitHash
77+
78+
Wrapper around [`git_commit_create`](https://libgit2.github.com/libgit2/#HEAD/group/commit/git_commit_create).
79+
Create a commit in the repository `repo`. `msg` is the commit message. Return the OID of the new commit.
80+
81+
The keyword arguments are:
82+
* `refname::AbstractString=Consts.HEAD_FILE`: if not NULL, the name of the reference to update to point to
83+
the new commit. For example, `"HEAD"` will update the HEAD of the current branch. If the reference does
84+
not yet exist, it will be created.
85+
* `author::Signature = Signature(repo)` is a `Signature` containing information about the person who authored the commit.
86+
* `committer::Signature = Signature(repo)` is a `Signature` containing information about the person who commited the commit to
87+
the repository. Not necessarily the same as `author`, for instance if `author` emailed a patch to
88+
`committer` who committed it.
89+
* `tree_id::GitHash = GitHash()` is a git tree to use to create the commit, showing its ancestry and relationship with
90+
any other history. `tree` must belong to `repo`.
91+
* `parent_ids::Vector{GitHash}=GitHash[]` is a list of commits by [`GitHash`](@ref) to use as parent
92+
commits for the new one, and may be empty. A commit might have multiple parents if it is a merge commit, for example.
93+
"""
7794
function commit(repo::GitRepo, msg::AbstractString;
7895
refname::AbstractString=Consts.HEAD_FILE,
7996
author::Signature = Signature(repo),

0 commit comments

Comments
 (0)