diff --git a/Library/Homebrew/dev-cmd/contributions.rb b/Library/Homebrew/dev-cmd/contributions.rb index 3bdc2832bb..ed4a8d2138 100755 --- a/Library/Homebrew/dev-cmd/contributions.rb +++ b/Library/Homebrew/dev-cmd/contributions.rb @@ -171,9 +171,16 @@ module Homebrew 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] = { - author: GitHub.repo_commit_count_for_user(repo_full_name, person, "author", args), - committer: GitHub.repo_commit_count_for_user(repo_full_name, person, "committer", args), + author: commits_authored, + committer: commits_committed, coauthorships: git_log_trailers_cmd(T.must(repo_path), person, "Co-authored-by", args), reviews: GitHub.count_issues( "",