Commit 51c167554cf492be98cecad182a6870cd6febb82
1 parent
22817398
Exists in
master
and in
4 other branches
added Gitlab::Git::Blame for git blame feature
Showing
1 changed file
with
22 additions
and
0 deletions
Show diff stats
| ... | ... | @@ -0,0 +1,22 @@ |
| 1 | +module Gitlab | |
| 2 | + module Git | |
| 3 | + class Blame | |
| 4 | + | |
| 5 | + attr_accessor :repository, :sha, :path | |
| 6 | + | |
| 7 | + def initialize(repository, sha, path) | |
| 8 | + @repository, @sha, @path = repository, sha, path | |
| 9 | + | |
| 10 | + end | |
| 11 | + | |
| 12 | + def each | |
| 13 | + raw_blame = Grit::Blob.blame(repository.repo, sha, path) | |
| 14 | + | |
| 15 | + raw_blame.each do |commit, lines| | |
| 16 | + commit = Gitlab::Git::Commit.new(commit) | |
| 17 | + yield(commit, lines) | |
| 18 | + end | |
| 19 | + end | |
| 20 | + end | |
| 21 | + end | |
| 22 | +end | ... | ... |