From 3cfb989a5d26a58b68f095e468a181965f445a50 Mon Sep 17 00:00:00 2001 From: kshyatt Date: Thu, 4 May 2017 20:46:17 -0700 Subject: [PATCH] Add example for authors --- base/libgit2/libgit2.jl | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/base/libgit2/libgit2.jl b/base/libgit2/libgit2.jl index ac7dfa7a1683b..200ddea137d27 100644 --- a/base/libgit2/libgit2.jl +++ b/base/libgit2/libgit2.jl @@ -749,6 +749,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", "TEST@TEST.COM", 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