dev-cmd/contributions: Deduplicate same author/committer commits
- Double counting is artificially inflating folks' contributions (sadly ;-)). - Since I'm not going to enumerate every possible author to filter by *both* fields via the API, let's do some arithmetic to figure out the unique committer numbers for a user.
This commit is contained in:
parent
4be55ddcc4
commit
fcb01e49a2
@ -171,9 +171,16 @@ module Homebrew
|
|||||||
|
|
||||||
puts "Determining contributions for #{person} on #{repo_full_name}..." if args.verbose?
|
puts "Determining contributions for #{person} on #{repo_full_name}..." if args.verbose?
|
||||||
|
|
||||||
|
commits_authored = GitHub.repo_commit_count_for_user(repo_full_name, person, "author", args)
|
||||||
|
commits_committed = GitHub.repo_commit_count_for_user(repo_full_name, person, "committer", args)
|
||||||
|
# Only count committers where the author is not the same person. Avoid negative numbers or subtracting zero.
|
||||||
|
if commits_authored.positive? && commits_committed.positive?
|
||||||
|
commits_committed = commits_authored - commits_committed
|
||||||
|
end
|
||||||
|
|
||||||
data[repo] = {
|
data[repo] = {
|
||||||
author: GitHub.repo_commit_count_for_user(repo_full_name, person, "author", args),
|
author: commits_authored,
|
||||||
committer: GitHub.repo_commit_count_for_user(repo_full_name, person, "committer", args),
|
committer: commits_committed,
|
||||||
coauthorships: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", args),
|
coauthorships: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", args),
|
||||||
reviews: GitHub.count_issues(
|
reviews: GitHub.count_issues(
|
||||||
"",
|
"",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user