Skip to content

Commit

Permalink
Merge pull request #21706 from JuliaLang/ksh/authors
Browse files Browse the repository at this point in the history
Add example for authors
  • Loading branch information
kshyatt authored May 6, 2017
2 parents 45b2c33 + 3cfb989 commit 11724ff
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions base/libgit2/libgit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,26 @@ end
authors(repo::GitRepo) -> Vector{Signature}
Returns all authors of commits to the `repo` repository.
# Example
```julia
repo = LibGit2.GitRepo(repo_path)
repo_file = open(joinpath(repo_path, test_file), "a")
println(repo_file, commit_msg)
flush(repo_file)
LibGit2.add!(repo, test_file)
sig = LibGit2.Signature("TEST", "[email protected]", round(time(), 0), 0)
commit_oid1 = LibGit2.commit(repo, "commit1"; author=sig, committer=sig)
println(repo_file, randstring(10))
flush(repo_file)
LibGit2.add!(repo, test_file)
commit_oid2 = LibGit2.commit(repo, "commit2"; author=sig, committer=sig)
# will be a Vector of [sig, sig]
auths = LibGit2.authors(repo)
```
"""
function authors(repo::GitRepo)
return with(GitRevWalker(repo)) do walker
Expand Down

0 comments on commit 11724ff

Please sign in to comment.