added Gitlab::Git::Blame for git blame feature
This commit is contained in:
parent
22817398e6
commit
51c167554c
1 changed files with 22 additions and 0 deletions
22
lib/gitlab/git/blame.rb
Normal file
22
lib/gitlab/git/blame.rb
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
module Gitlab
|
||||||
|
module Git
|
||||||
|
class Blame
|
||||||
|
|
||||||
|
attr_accessor :repository, :sha, :path
|
||||||
|
|
||||||
|
def initialize(repository, sha, path)
|
||||||
|
@repository, @sha, @path = repository, sha, path
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
def each
|
||||||
|
raw_blame = Grit::Blob.blame(repository.repo, sha, path)
|
||||||
|
|
||||||
|
raw_blame.each do |commit, lines|
|
||||||
|
commit = Gitlab::Git::Commit.new(commit)
|
||||||
|
yield(commit, lines)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Reference in a new issue