Commit b92655663c9f066de6a67217ad9a55f38e20cffd
1 parent
d602d5b1
Exists in
master
and in
4 other branches
Update main calls to gitlab_git
Showing
5 changed files
with
22 additions
and
16 deletions
Show diff stats
Gemfile
| ... | ... | @@ -23,7 +23,7 @@ gem 'omniauth-github' |
| 23 | 23 | |
| 24 | 24 | # Extracting information from a git repository |
| 25 | 25 | # Provide access to Gitlab::Git library |
| 26 | -gem 'gitlab_git', '~> 1.4.1' | |
| 26 | +gem 'gitlab_git', path: '../gitlab_git'#'~> 1.4.1' | |
| 27 | 27 | |
| 28 | 28 | # Ruby/Rack Git Smart-HTTP Server Handler |
| 29 | 29 | gem 'gitlab-grack', '~> 1.0.1', require: 'grack' | ... | ... |
Gemfile.lock
| ... | ... | @@ -12,6 +12,14 @@ GIT |
| 12 | 12 | specs: |
| 13 | 13 | raphael-rails (2.1.0) |
| 14 | 14 | |
| 15 | +PATH | |
| 16 | + remote: ../gitlab_git | |
| 17 | + specs: | |
| 18 | + gitlab_git (1.4.1) | |
| 19 | + activesupport (~> 3.2.13) | |
| 20 | + github-linguist (~> 2.3.4) | |
| 21 | + gitlab-grit (~> 2.6.0) | |
| 22 | + | |
| 15 | 23 | GEM |
| 16 | 24 | remote: https://rubygems.org/ |
| 17 | 25 | specs: |
| ... | ... | @@ -176,10 +184,6 @@ GEM |
| 176 | 184 | gitlab-pygments.rb (0.3.2) |
| 177 | 185 | posix-spawn (~> 0.3.6) |
| 178 | 186 | yajl-ruby (~> 1.1.0) |
| 179 | - gitlab_git (1.4.1) | |
| 180 | - activesupport (~> 3.2.13) | |
| 181 | - github-linguist (~> 2.3.4) | |
| 182 | - gitlab-grit (~> 2.6.0) | |
| 183 | 187 | gitlab_meta (6.0) |
| 184 | 188 | gitlab_omniauth-ldap (1.0.3) |
| 185 | 189 | net-ldap (~> 0.3.1) |
| ... | ... | @@ -275,7 +279,7 @@ GEM |
| 275 | 279 | minitest (4.7.4) |
| 276 | 280 | modernizr (2.6.2) |
| 277 | 281 | sprockets (~> 2.0) |
| 278 | - multi_json (1.7.7) | |
| 282 | + multi_json (1.7.8) | |
| 279 | 283 | multi_xml (0.5.4) |
| 280 | 284 | multipart-post (1.2.0) |
| 281 | 285 | mysql2 (0.3.11) |
| ... | ... | @@ -568,7 +572,7 @@ DEPENDENCIES |
| 568 | 572 | gitlab-gollum-lib (~> 1.0.1) |
| 569 | 573 | gitlab-grack (~> 1.0.1) |
| 570 | 574 | gitlab-pygments.rb (~> 0.3.2) |
| 571 | - gitlab_git (~> 1.4.1) | |
| 575 | + gitlab_git! | |
| 572 | 576 | gitlab_meta (= 6.0) |
| 573 | 577 | gitlab_omniauth-ldap (= 1.0.3) |
| 574 | 578 | gon | ... | ... |
app/models/merge_request.rb
| ... | ... | @@ -137,7 +137,7 @@ class MergeRequest < ActiveRecord::Base |
| 137 | 137 | end |
| 138 | 138 | |
| 139 | 139 | def unmerged_diffs |
| 140 | - project.repository.diffs_between(source_branch, target_branch) | |
| 140 | + Gitlab::Git::Diff.between(project.repository, source_branch, target_branch) | |
| 141 | 141 | end |
| 142 | 142 | |
| 143 | 143 | def last_commit | ... | ... |
app/models/repository.rb
| ... | ... | @@ -18,19 +18,25 @@ class Repository |
| 18 | 18 | end |
| 19 | 19 | |
| 20 | 20 | def commit(id = nil) |
| 21 | - commit = raw_repository.commit(id) | |
| 21 | + commit = Gitlab::Git::Commit.find(raw_repository, id) | |
| 22 | 22 | commit = Commit.new(commit) if commit |
| 23 | 23 | commit |
| 24 | 24 | end |
| 25 | 25 | |
| 26 | 26 | def commits(ref, path = nil, limit = nil, offset = nil) |
| 27 | - commits = raw_repository.commits(ref, path, limit, offset) | |
| 27 | + commits = Gitlab::Git::Commit.where( | |
| 28 | + repo: raw_repository, | |
| 29 | + ref: ref, | |
| 30 | + path: path, | |
| 31 | + limit: limit, | |
| 32 | + offset: offset, | |
| 33 | + ) | |
| 28 | 34 | commits = Commit.decorate(commits) if commits.present? |
| 29 | 35 | commits |
| 30 | 36 | end |
| 31 | 37 | |
| 32 | - def commits_between(target, source) | |
| 33 | - commits = raw_repository.commits_between(target, source) | |
| 38 | + def commits_between(from, to) | |
| 39 | + commits = Gitlab::Git::Commit.between(raw_repository, from, to) | |
| 34 | 40 | commits = Commit.decorate(commits) if commits.present? |
| 35 | 41 | commits |
| 36 | 42 | end | ... | ... |
lib/extracts_path.rb
| ... | ... | @@ -95,13 +95,9 @@ module ExtractsPath |
| 95 | 95 | # resolved (e.g., when a user inserts an invalid path or ref). |
| 96 | 96 | def assign_ref_vars |
| 97 | 97 | @id = get_id |
| 98 | - | |
| 99 | 98 | @ref, @path = extract_ref(@id) |
| 100 | - | |
| 101 | 99 | @repo = @project.repository |
| 102 | - | |
| 103 | 100 | @commit = @repo.commit(@ref) |
| 104 | - | |
| 105 | 101 | @tree = Tree.new(@repo, @commit.id, @ref, @path) |
| 106 | 102 | @hex_path = Digest::SHA1.hexdigest(@path) |
| 107 | 103 | @logs_path = logs_file_project_ref_path(@project, @ref, @path) | ... | ... |