From b92655663c9f066de6a67217ad9a55f38e20cffd Mon Sep 17 00:00:00 2001
From: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Date: Mon, 5 Aug 2013 16:51:04 +0300
Subject: [PATCH] Update main calls to gitlab_git

---
 Gemfile                     |  2 +-
 Gemfile.lock                | 16 ++++++++++------
 app/models/merge_request.rb |  2 +-
 app/models/repository.rb    | 14 ++++++++++----
 lib/extracts_path.rb        |  4 ----
 5 files changed, 22 insertions(+), 16 deletions(-)

diff --git a/Gemfile b/Gemfile
index e679f3ee1aa..f5e05a1c8eb 100644
--- a/Gemfile
+++ b/Gemfile
@@ -23,7 +23,7 @@ gem 'omniauth-github'
 
 # Extracting information from a git repository
 # Provide access to Gitlab::Git library
-gem 'gitlab_git', '~> 1.4.1'
+gem 'gitlab_git', path: '../gitlab_git'#'~> 1.4.1'
 
 # Ruby/Rack Git Smart-HTTP Server Handler
 gem 'gitlab-grack', '~> 1.0.1', require: 'grack'
diff --git a/Gemfile.lock b/Gemfile.lock
index 6eedadc74c6..444a3dc8ba1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -12,6 +12,14 @@ GIT
   specs:
     raphael-rails (2.1.0)
 
+PATH
+  remote: ../gitlab_git
+  specs:
+    gitlab_git (1.4.1)
+      activesupport (~> 3.2.13)
+      github-linguist (~> 2.3.4)
+      gitlab-grit (~> 2.6.0)
+
 GEM
   remote: https://rubygems.org/
   specs:
@@ -176,10 +184,6 @@ GEM
     gitlab-pygments.rb (0.3.2)
       posix-spawn (~> 0.3.6)
       yajl-ruby (~> 1.1.0)
-    gitlab_git (1.4.1)
-      activesupport (~> 3.2.13)
-      github-linguist (~> 2.3.4)
-      gitlab-grit (~> 2.6.0)
     gitlab_meta (6.0)
     gitlab_omniauth-ldap (1.0.3)
       net-ldap (~> 0.3.1)
@@ -275,7 +279,7 @@ GEM
     minitest (4.7.4)
     modernizr (2.6.2)
       sprockets (~> 2.0)
-    multi_json (1.7.7)
+    multi_json (1.7.8)
     multi_xml (0.5.4)
     multipart-post (1.2.0)
     mysql2 (0.3.11)
@@ -568,7 +572,7 @@ DEPENDENCIES
   gitlab-gollum-lib (~> 1.0.1)
   gitlab-grack (~> 1.0.1)
   gitlab-pygments.rb (~> 0.3.2)
-  gitlab_git (~> 1.4.1)
+  gitlab_git!
   gitlab_meta (= 6.0)
   gitlab_omniauth-ldap (= 1.0.3)
   gon
diff --git a/app/models/merge_request.rb b/app/models/merge_request.rb
index 2a476355404..9cd883f421b 100644
--- a/app/models/merge_request.rb
+++ b/app/models/merge_request.rb
@@ -137,7 +137,7 @@ class MergeRequest < ActiveRecord::Base
   end
 
   def unmerged_diffs
-    project.repository.diffs_between(source_branch, target_branch)
+    Gitlab::Git::Diff.between(project.repository, source_branch, target_branch)
   end
 
   def last_commit
diff --git a/app/models/repository.rb b/app/models/repository.rb
index 588cabfbae0..cd33782a4cc 100644
--- a/app/models/repository.rb
+++ b/app/models/repository.rb
@@ -18,19 +18,25 @@ class Repository
   end
 
   def commit(id = nil)
-    commit = raw_repository.commit(id)
+    commit = Gitlab::Git::Commit.find(raw_repository, id)
     commit = Commit.new(commit) if commit
     commit
   end
 
   def commits(ref, path = nil, limit = nil, offset = nil)
-    commits = raw_repository.commits(ref, path, limit, offset)
+    commits = Gitlab::Git::Commit.where(
+      repo: raw_repository,
+      ref: ref,
+      path: path,
+      limit: limit,
+      offset: offset,
+    )
     commits = Commit.decorate(commits) if commits.present?
     commits
   end
 
-  def commits_between(target, source)
-    commits = raw_repository.commits_between(target, source)
+  def commits_between(from, to)
+    commits = Gitlab::Git::Commit.between(raw_repository, from, to)
     commits = Commit.decorate(commits) if commits.present?
     commits
   end
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index a81c80cfc6f..d1035240cb6 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -95,13 +95,9 @@ module ExtractsPath
   # resolved (e.g., when a user inserts an invalid path or ref).
   def assign_ref_vars
     @id = get_id
-
     @ref, @path = extract_ref(@id)
-
     @repo = @project.repository
-
     @commit = @repo.commit(@ref)
-
     @tree = Tree.new(@repo, @commit.id, @ref, @path)
     @hex_path = Digest::SHA1.hexdigest(@path)
     @logs_path = logs_file_project_ref_path(@project, @ref, @path)
-- 
GitLab