-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #21706 from JuliaLang/ksh/authors
Add example for authors
- Loading branch information
Showing
1 changed file
with
20 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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 | ||
|