Sha256: 3bf418c5c72bd7edfa47c90ec7923e951c9f9204007580122214251cb3fa790a

Contents?: true

Size: 670 Bytes

Versions: 25

Compression:

Stored size: 670 Bytes

Contents

module Gitlab
  module Git
    class Blame
      attr_accessor :blob

      def initialize(repository, sha, path)
        @repo = repository.rugged
        @blame = Rugged::Blame.new(@repo, path, { newest_commit: sha })
        @blob = Blob.find(repository, sha, path)
        @lines = @blob.data.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

25 entries across 25 versions & 1 rubygems

Version Path
gitlab_git-7.2.11 lib/gitlab_git/blame.rb
gitlab_git-7.2.10 lib/gitlab_git/blame.rb
gitlab_git-7.2.9 lib/gitlab_git/blame.rb
gitlab_git-7.2.8 lib/gitlab_git/blame.rb
gitlab_git-7.2.6 lib/gitlab_git/blame.rb
gitlab_git-7.2.5 lib/gitlab_git/blame.rb
gitlab_git-7.2.4 lib/gitlab_git/blame.rb
gitlab_git-7.2.3 lib/gitlab_git/blame.rb
gitlab_git-7.2.2 lib/gitlab_git/blame.rb
gitlab_git-7.2.1 lib/gitlab_git/blame.rb
gitlab_git-7.2.0 lib/gitlab_git/blame.rb
gitlab_git-7.1.13 lib/gitlab_git/blame.rb
gitlab_git-7.1.12 lib/gitlab_git/blame.rb
gitlab_git-7.1.11 lib/gitlab_git/blame.rb
gitlab_git-7.1.10 lib/gitlab_git/blame.rb
gitlab_git-7.1.9 lib/gitlab_git/blame.rb
gitlab_git-7.1.8 lib/gitlab_git/blame.rb
gitlab_git-7.1.7 lib/gitlab_git/blame.rb
gitlab_git-7.1.6 lib/gitlab_git/blame.rb
gitlab_git-7.1.5 lib/gitlab_git/blame.rb