added Gitlab::Git::Blame for git blame feature

master
Dmitriy Zaporozhets 2013-04-01 16:02:54 +03:00
parent 22817398e6
commit 51c167554c
1 changed files with 22 additions and 0 deletions

22
lib/gitlab/git/blame.rb Normal file
View 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