diff options
| author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-08-08 14:27:22 +0000 | 
|---|---|---|
| committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2017-08-08 14:27:22 +0000 | 
| commit | 14391151832e0fdd709c08d0d3f704b47b1d4e4e (patch) | |
| tree | 270be924e37becffbfd418729f1f696acf3e12f9 /app | |
| parent | 2aa460de76840d469071f17df9433c614e700e6e (diff) | |
| parent | 3ce6f03f1437633c9328dc30aa5272a49368655b (diff) | |
| download | gitlab-ce-14391151832e0fdd709c08d0d3f704b47b1d4e4e.tar.gz | |
Merge branch 'gitaly-find-commit' into 'master'
Incorporate Gitaly's CommitService.FindCommit RPC
Closes gitaly#402
See merge request !13094
Diffstat (limited to 'app')
| -rw-r--r-- | app/models/commit.rb | 17 | ||||
| -rw-r--r-- | app/models/merge_request_diff.rb | 4 | ||||
| -rw-r--r-- | app/models/repository.rb | 4 | 
3 files changed, 8 insertions, 17 deletions
diff --git a/app/models/commit.rb b/app/models/commit.rb index 7940733f557..638fddc5d3d 100644 --- a/app/models/commit.rb +++ b/app/models/commit.rb @@ -55,7 +55,8 @@ class Commit      end      def from_hash(hash, project) -      new(Gitlab::Git::Commit.new(hash), project) +      raw_commit = Gitlab::Git::Commit.new(project.repository.raw, hash) +      new(raw_commit, project)      end      def valid_hash?(key) @@ -320,21 +321,11 @@ class Commit    end    def raw_diffs(*args) -    if Gitlab::GitalyClient.feature_enabled?(:commit_raw_diffs) -      Gitlab::GitalyClient::CommitService.new(project.repository).diff_from_parent(self, *args) -    else -      raw.diffs(*args) -    end +    raw.diffs(*args)    end    def raw_deltas -    @deltas ||= Gitlab::GitalyClient.migrate(:commit_deltas) do |is_enabled| -      if is_enabled -        Gitlab::GitalyClient::CommitService.new(project.repository).commit_deltas(self) -      else -        raw.deltas -      end -    end +    @deltas ||= raw.deltas    end    def diffs(diff_options = nil) diff --git a/app/models/merge_request_diff.rb b/app/models/merge_request_diff.rb index d9d746ccf41..58050e1f438 100644 --- a/app/models/merge_request_diff.rb +++ b/app/models/merge_request_diff.rb @@ -282,9 +282,7 @@ class MergeRequestDiff < ActiveRecord::Base    def load_commits      commits = st_commits.presence || merge_request_diff_commits -    commits.map do |commit| -      Commit.new(Gitlab::Git::Commit.new(commit.to_hash), merge_request.source_project) -    end +    commits.map { |commit| Commit.from_hash(commit.to_hash, project) }    end    def save_diffs diff --git a/app/models/repository.rb b/app/models/repository.rb index 3b5d0e00c70..ff82b958255 100644 --- a/app/models/repository.rb +++ b/app/models/repository.rb @@ -64,6 +64,8 @@ class Repository      @raw_repository ||= initialize_raw_repository    end +  alias_method :raw, :raw_repository +    # Return absolute path to repository    def path_to_repo      @path_to_repo ||= File.expand_path( @@ -763,7 +765,7 @@ class Repository        index = Gitlab::Git::Index.new(raw_repository)        if start_commit -        index.read_tree(start_commit.raw_commit.tree) +        index.read_tree(start_commit.rugged_commit.tree)          parents = [start_commit.sha]        else          parents = []  | 
