diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-01 16:02:54 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2013-04-01 16:02:54 +0300 |
commit | 51c167554cf492be98cecad182a6870cd6febb82 (patch) | |
tree | 9e3f033d4ba39f89364aa64943b0138be047e2f9 | |
parent | 22817398e6c1cf9a479fecd99c55369fd81717cb (diff) | |
download | gitlab-ce-51c167554cf492be98cecad182a6870cd6febb82.tar.gz |
added Gitlab::Git::Blame for git blame feature
-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 |