lauriii / drupalcores

A project to generate a list of core contributers
http://drupalcores.com
MIT License
27 stars 38 forks source link

Reverted commits should remove 2 commit mentions instead of one #38

Closed pcambra closed 9 years ago

pcambra commented 9 years ago

The flow is normally:

Bunch of work Commit https://www.youtube.com/watch?v=1EBfxjSFAxQ Revert Bunch of work Commit

When it finally goes in, it should be counted as 1 and now I think it's counted as 2.

lewisnyman commented 9 years ago

I'm not sure if I understand this code but it looks like:

%x[#{git_command}].split("\n").each do |c|
  if c.index('Revert') == 0 then
    reverts.push(c.scan(/#([0-9]+)/))
  else
    commits.push(c)
  end
end

If it finds a reverted commit then it never counts that commit, so later it removes the reverted commit from the count.

pcambra commented 9 years ago

Finally was able to install and run it.

The commit is never added to the array when there's a Revert.

  if c.index('Revert') == 0 then
    reverts.push(c.scan(/#([0-9]+)/))
  else
    commits.push(c)
  end

And then is removed later

  if r = reverts.index{ |item| item == issue_number }
    commits.delete_at(i)
    reverts.delete_at(r)
  end

So that's right :), it is not counted twice.