Sha256: 659a010129f8281815d9bf3427fa85348ae0893338d0351a66c68d27bd976710

Contents?: true

Size: 615 Bytes

Versions: 14

Compression:

Stored size: 615 Bytes

Contents

module Gitlab
  module Git
    class Blame

      def initialize(repository, sha, path)
        @repo = repository.rugged
        @blame = Rugged::Blame.new(@repo, path)
        @blob = @repo.blob_at(sha, path)
        @lines = @blob.content.split("\n")
      end

      def each
        @blame.each do |blame|
          from = blame[:final_start_line_number] - 1
          commit = @repo.lookup(blame[:final_commit_id])

          yield(Gitlab::Git::Commit.new(commit),
              @lines[from, blame[:lines_in_hunk]] || [],
              blame[:final_start_line_number])
        end
      end
    end
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
gitlab_git-7.0.0.rc13 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc12 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc11 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc10 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc9 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc8 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc7 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc6 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc5 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc4 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc3 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc2 lib/gitlab_git/blame.rb
gitlab_git-7.0.0.rc1 lib/gitlab_git/blame.rb
gitlab_git-6.3.0 lib/gitlab_git/blame.rb