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,7 +23,7 @@ gem 'omniauth-github' | ||
| 23 | 23 | ||
| 24 | # Extracting information from a git repository | 24 | # Extracting information from a git repository |
| 25 | # Provide access to Gitlab::Git library | 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 | # Ruby/Rack Git Smart-HTTP Server Handler | 28 | # Ruby/Rack Git Smart-HTTP Server Handler |
| 29 | gem 'gitlab-grack', '~> 1.0.1', require: 'grack' | 29 | gem 'gitlab-grack', '~> 1.0.1', require: 'grack' |
Gemfile.lock
| @@ -12,6 +12,14 @@ GIT | @@ -12,6 +12,14 @@ GIT | ||
| 12 | specs: | 12 | specs: |
| 13 | raphael-rails (2.1.0) | 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 | GEM | 23 | GEM |
| 16 | remote: https://rubygems.org/ | 24 | remote: https://rubygems.org/ |
| 17 | specs: | 25 | specs: |
| @@ -176,10 +184,6 @@ GEM | @@ -176,10 +184,6 @@ GEM | ||
| 176 | gitlab-pygments.rb (0.3.2) | 184 | gitlab-pygments.rb (0.3.2) |
| 177 | posix-spawn (~> 0.3.6) | 185 | posix-spawn (~> 0.3.6) |
| 178 | yajl-ruby (~> 1.1.0) | 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 | gitlab_meta (6.0) | 187 | gitlab_meta (6.0) |
| 184 | gitlab_omniauth-ldap (1.0.3) | 188 | gitlab_omniauth-ldap (1.0.3) |
| 185 | net-ldap (~> 0.3.1) | 189 | net-ldap (~> 0.3.1) |
| @@ -275,7 +279,7 @@ GEM | @@ -275,7 +279,7 @@ GEM | ||
| 275 | minitest (4.7.4) | 279 | minitest (4.7.4) |
| 276 | modernizr (2.6.2) | 280 | modernizr (2.6.2) |
| 277 | sprockets (~> 2.0) | 281 | sprockets (~> 2.0) |
| 278 | - multi_json (1.7.7) | 282 | + multi_json (1.7.8) |
| 279 | multi_xml (0.5.4) | 283 | multi_xml (0.5.4) |
| 280 | multipart-post (1.2.0) | 284 | multipart-post (1.2.0) |
| 281 | mysql2 (0.3.11) | 285 | mysql2 (0.3.11) |
| @@ -568,7 +572,7 @@ DEPENDENCIES | @@ -568,7 +572,7 @@ DEPENDENCIES | ||
| 568 | gitlab-gollum-lib (~> 1.0.1) | 572 | gitlab-gollum-lib (~> 1.0.1) |
| 569 | gitlab-grack (~> 1.0.1) | 573 | gitlab-grack (~> 1.0.1) |
| 570 | gitlab-pygments.rb (~> 0.3.2) | 574 | gitlab-pygments.rb (~> 0.3.2) |
| 571 | - gitlab_git (~> 1.4.1) | 575 | + gitlab_git! |
| 572 | gitlab_meta (= 6.0) | 576 | gitlab_meta (= 6.0) |
| 573 | gitlab_omniauth-ldap (= 1.0.3) | 577 | gitlab_omniauth-ldap (= 1.0.3) |
| 574 | gon | 578 | gon |
app/models/merge_request.rb
| @@ -137,7 +137,7 @@ class MergeRequest < ActiveRecord::Base | @@ -137,7 +137,7 @@ class MergeRequest < ActiveRecord::Base | ||
| 137 | end | 137 | end |
| 138 | 138 | ||
| 139 | def unmerged_diffs | 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 | end | 141 | end |
| 142 | 142 | ||
| 143 | def last_commit | 143 | def last_commit |
app/models/repository.rb
| @@ -18,19 +18,25 @@ class Repository | @@ -18,19 +18,25 @@ class Repository | ||
| 18 | end | 18 | end |
| 19 | 19 | ||
| 20 | def commit(id = nil) | 20 | def commit(id = nil) |
| 21 | - commit = raw_repository.commit(id) | 21 | + commit = Gitlab::Git::Commit.find(raw_repository, id) |
| 22 | commit = Commit.new(commit) if commit | 22 | commit = Commit.new(commit) if commit |
| 23 | commit | 23 | commit |
| 24 | end | 24 | end |
| 25 | 25 | ||
| 26 | def commits(ref, path = nil, limit = nil, offset = nil) | 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 | commits = Commit.decorate(commits) if commits.present? | 34 | commits = Commit.decorate(commits) if commits.present? |
| 29 | commits | 35 | commits |
| 30 | end | 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 | commits = Commit.decorate(commits) if commits.present? | 40 | commits = Commit.decorate(commits) if commits.present? |
| 35 | commits | 41 | commits |
| 36 | end | 42 | end |
lib/extracts_path.rb
| @@ -95,13 +95,9 @@ module ExtractsPath | @@ -95,13 +95,9 @@ module ExtractsPath | ||
| 95 | # resolved (e.g., when a user inserts an invalid path or ref). | 95 | # resolved (e.g., when a user inserts an invalid path or ref). |
| 96 | def assign_ref_vars | 96 | def assign_ref_vars |
| 97 | @id = get_id | 97 | @id = get_id |
| 98 | - | ||
| 99 | @ref, @path = extract_ref(@id) | 98 | @ref, @path = extract_ref(@id) |
| 100 | - | ||
| 101 | @repo = @project.repository | 99 | @repo = @project.repository |
| 102 | - | ||
| 103 | @commit = @repo.commit(@ref) | 100 | @commit = @repo.commit(@ref) |
| 104 | - | ||
| 105 | @tree = Tree.new(@repo, @commit.id, @ref, @path) | 101 | @tree = Tree.new(@repo, @commit.id, @ref, @path) |
| 106 | @hex_path = Digest::SHA1.hexdigest(@path) | 102 | @hex_path = Digest::SHA1.hexdigest(@path) |
| 107 | @logs_path = logs_file_project_ref_path(@project, @ref, @path) | 103 | @logs_path = logs_file_project_ref_path(@project, @ref, @path) |