diff --git a/lib/git_stats/git_data/commit.rb b/lib/git_stats/git_data/commit.rb index f0f4462ad..e6c3b23d3 100644 --- a/lib/git_stats/git_data/commit.rb +++ b/lib/git_stats/git_data/commit.rb @@ -41,7 +41,7 @@ module GitStats end def lines_count - @lines_count ||= repo.run("git diff --shortstat `git hash-object -t tree /dev/null` #{self.sha} -- #{repo.tree_path}").lines.map do |line| + @lines_count ||= repo.run("git diff --shortstat --no-renames `git hash-object -t tree /dev/null` #{self.sha} -- #{repo.tree_path}").lines.map do |line| line[/(\d+) insertions?/, 1].to_i end.sum end diff --git a/lib/git_stats/git_data/short_stat.rb b/lib/git_stats/git_data/short_stat.rb index 33604c90c..d1afe42b9 100644 --- a/lib/git_stats/git_data/short_stat.rb +++ b/lib/git_stats/git_data/short_stat.rb @@ -19,7 +19,7 @@ module GitStats private def calculate_stat - stat_line = commit.repo.run("git show --shortstat --oneline #{commit.sha} -- #{commit.repo.tree_path}").lines.to_a[1] + stat_line = commit.repo.run("git show --shortstat --oneline --no-renames #{commit.sha} -- #{commit.repo.tree_path}").lines.to_a[1] if stat_line.blank? @files_changed = @insertions = @deletions = 0 else diff --git a/spec/git_data/short_stat_spec.rb b/spec/git_data/short_stat_spec.rb index 57efa675e..325574f74 100644 --- a/spec/git_data/short_stat_spec.rb +++ b/spec/git_data/short_stat_spec.rb @@ -14,7 +14,7 @@ describe GitStats::GitData::ShortStat do {content: '', expect: [0, 0, 0]}, ].each do |test| it "#{test[:content]} parsing" do - commit.repo.should_receive(:run).with("git show --shortstat --oneline abc -- .").and_return("abc some commit\n#{test[:content]}") + commit.repo.should_receive(:run).with("git show --shortstat --oneline --no-renames abc -- .").and_return("abc some commit\n#{test[:content]}") commit.short_stat.should be_a(GitStats::GitData::ShortStat)