git-fame-rb icon indicating copy to clipboard operation
git-fame-rb copied to clipboard

Crash when running git-fame in a specific repo

Open waldyrious opened this issue 5 years ago • 10 comments
trafficstars

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.

waldyrious avatar Mar 29 '20 11:03 waldyrious

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.

ORESoftware avatar Mar 30 '20 22:03 ORESoftware

@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.

waldyrious avatar Apr 14 '20 16:04 waldyrious

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.

ORESoftware avatar Apr 14 '20 21:04 ORESoftware

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).

waldyrious avatar Apr 15 '20 09:04 waldyrious

@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.

oleander avatar Apr 16 '20 12:04 oleander

@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?

waldyrious avatar Apr 16 '20 13:04 waldyrious

@waldyrious Feel free to add it to the README ツ

oleander avatar Apr 16 '20 14:04 oleander

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.

ORESoftware avatar Apr 16 '20 16:04 ORESoftware

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 [email protected]:

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 avatar Apr 16 '20 16:04 oleander

@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

oleander avatar Apr 16 '20 17:04 oleander