oleander / git-fame-rb

A command-line tool that helps you summarize and pretty-print collaborators based on contributions
MIT License
948 stars 73 forks source link

Crash when running git-fame in a specific repo #96

Open waldyrious opened 4 years ago

waldyrious commented 4 years ago

I can consistently reproduce the following crash by running git fame in the alif-type/libertinus repository.

The command starts executing normally, then stops for several seconds at 68%:

$ git fame
Git Fame:       68% |ooooooooooooooooooooooo            | ETA:   0:00:04

It then crashes with the following output:

#<Thread:0x00007fa8c29868a0@/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:287 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:287:in `block (2 levels) in capture3'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:287:in `read': stream closed in another thread (IOError)

#<Thread:0x00007fa8c2986468@/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:288 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
    1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:288:in `block (2 levels) in capture3'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:288:in `read': stream closed in another thread (IOError)

The full stack trace is printed after I hit Ctrl+C:

Traceback (most recent call last):
    23: from /usr/local/bin/git-fame:23:in `<main>'
    22: from /usr/local/bin/git-fame:23:in `load'
    21: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/bin/git-fame:36:in `<top (required)>'
    20: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/bin/git-fame:36:in `new'
    19: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:92:in `initialize'
    18: from /Library/Ruby/Gems/2.6.0/gems/memoist-0.14.0/lib/memoist.rb:165:in `populate'
    17: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:179:in `populate'
    16: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:179:in `each'
    15: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:188:in `block in populate'
    14: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:314:in `execute'
    13: from /Library/Ruby/Gems/2.6.0/gems/memoist-0.14.0/lib/memoist.rb:209:in `run_with_timeout'
    12: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:327:in `run_with_timeout'
    11: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
    10: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
     9: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
     8: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
     7: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:93:in `block in timeout'
     6: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:327:in `block in run_with_timeout'
     5: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:334:in `run_no_timeout'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:281:in `capture3'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:101:in `popen3'
     2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:222:in `popen_run'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:222:in `ensure in popen_run'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/open3.rb:222:in `join': Interrupt
    17: from /usr/local/bin/git-fame:23:in `<main>'
    16: from /usr/local/bin/git-fame:23:in `load'
    15: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/bin/git-fame:36:in `<top (required)>'
    14: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/bin/git-fame:36:in `new'
    13: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:92:in `initialize'
    12: from /Library/Ruby/Gems/2.6.0/gems/memoist-0.14.0/lib/memoist.rb:165:in `populate'
    11: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:179:in `populate'
    10: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:179:in `each'
     9: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:188:in `block in populate'
     8: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:314:in `execute'
     7: from /Library/Ruby/Gems/2.6.0/gems/memoist-0.14.0/lib/memoist.rb:209:in `run_with_timeout'
     6: from /Library/Ruby/Gems/2.6.0/gems/git_fame-2.5.3/lib/git_fame/base.rb:327:in `run_with_timeout'
     5: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:108:in `timeout'
     4: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
     3: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `catch'
     2: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:33:in `block in catch'
     1: from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:97:in `block in timeout'
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/timeout.rb:in `ensure in block in timeout': Interrupt

Happy to provide any additional information that may help debug the issue.

ORESoftware commented 4 years ago

try using this instead

$ npm i -g fame
$ fame 

it's probably a data problem in the git log output, but the NPM package is written to avoid such data issues.

waldyrious commented 4 years ago

@ORESoftware that's indeed faster (thanks for the pointer!), but probably because it's counting something different: it seems to show only the total added/deleted/net lines, rather than the number of current code lines last touched by each author.

Don't get me wrong: the total added/deleted/net counts are still valid and useful metrics — just not interchangeable with what git fame does.

ORESoftware commented 4 years ago

what do you mean by current code lines versus total code lines? perhaps you mean just for the most recent commit?

the NPM package is going to total everything that comes out of git log for a given branch.

waldyrious commented 4 years ago

Yes, git fame uses the same information that git blame outputs (i.e. the last person to have touched each line of code) and summarizes that for the entire repository (or specific files/folders).

oleander commented 4 years ago

@waldyrious Thanks for the clarification.

@ORESoftware git-fame only looks at HEAD using git blame to generate its statistics, a snapshot of contributions to a project–if you will. That's why it's considerably slower then the library you recommended which uses git log.

waldyrious commented 4 years ago

@oleander I did notice that the README does not make this very clear, btw. It would be nice to add a clarification to prevent this mixup, WDYT?

oleander commented 4 years ago

@waldyrious Feel free to add it to the README ツ

ORESoftware commented 4 years ago

so it uses git blame for every commit or just the most recent commit? if its just the most recent commit, then that does not seem very comprehensive.

fame via NPM looks at all the commits on a branch and looks at lines changed for each commit by author.

oleander commented 4 years ago

It runs blame on every file in HEAD tracked by git. It then summarizes each line for each file and returns the result.

tors 16 apr. 2020 kl. 18:35 skrev ORES notifications@github.com:

so it uses git blame for every commit or just the most recent commit? if its just the most recent commit, then that does not seem very comprehensive.

— You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub https://github.com/oleander/git-fame-rb/issues/96#issuecomment-614761160, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABV5G6L4BVELUAAGHHN6JDRM4XT7ANCNFSM4LV6CYNA .

oleander commented 4 years ago

@ORESoftware Just read your edit. The difference is that this tool only looks at active contributions. Let's say you wrote 5 LOC. 4 of them were later overridden, deleted or changed**. Now your contribution is only 1 LOC as 4 of them were overridden, deleted or changed.

It's questionable wherever this is a good approach or not. I used it to evaluate a few private projects of mine about 8 years ago. For some reason, people kept on using it.

** Whitespace, newlines, and whatnot does not count