Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Priya Rani committed Dec 4, 2023
1 parent 2bc8f95 commit 492b4df
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/ohloh_scm/git/activity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,20 @@ def commits(opts = {})
# Yields each commit in the repository following the commit with SHA1 'after'.
# These commits are populated with diffs.
def each_commit(opts = {})
# Bug fix (hack) follows.
#
# git-whatchanged emits a merge commit multiple times, once for each parent, giving the
# delta to each parent in turn.
#
# This causes us to emit too many commits, with repeated merge commits.
#
# To fix this, we track the previous commit, and emit a new commit only if it is distinct
# from the previous.
#
# This means that the diffs for a merge commit yielded by this method will be the diffs
# vs. the first parent only, and diffs vs. other parents are lost.
# For OpenHub, this is fine because OpenHub ignores merge diffs anyway.
previous = nil
safe_open_log_file(opts) do |io|
if ENV['EXPENSIVE_COMMIT_COUNT'] && commit_count(opts) > ENV['EXPENSIVE_COMMIT_COUNT']&.to_i
io.each do |commit_sha|
Expand Down

0 comments on commit 492b4df

Please sign in to comment.