diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-01 17:02:54 +0400 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-01 17:02:54 +0400 |
commit | 51c167554cf492be98cecad182a6870cd6febb82 (patch) | |
tree | 9e3f033d4ba39f89364aa64943b0138be047e2f9 /lib | |
parent | 22817398e6c1cf9a479fecd99c55369fd81717cb (diff) |
added Gitlab::Git::Blame for git blame feature
Diffstat (limited to 'lib')
-rw-r--r-- | lib/gitlab/git/blame.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/gitlab/git/blame.rb b/lib/gitlab/git/blame.rb new file mode 100644 index 00000000000..d6e988b6762 --- /dev/null +++ b/lib/gitlab/git/blame.rb @@ -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 |