summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2017-01-04 14:54:47 -0500
committerRobert Speicher <rspeicher@gmail.com>2017-01-04 19:09:29 -0500
commit2e20a71d21408d0a98b392209ff78bade26984bb (patch)
treed2ee61a04ab1a8fb47bfbd015dd6a4fa324b8fd1
parenta00578ce5cdf4bab95990bca9e806c6322bb1384 (diff)
downloadgitlab-ce-rs-absorb-gitlab_git.tar.gz
Ensure internal Gitlab::Git references use the namespacers-absorb-gitlab_git
-rw-r--r--lib/gitlab/git/blob.rb16
-rw-r--r--lib/gitlab/git/commit.rb6
-rw-r--r--lib/gitlab/git/ref.rb2
-rw-r--r--lib/gitlab/git/repository.rb22
-rw-r--r--lib/gitlab/git/tree.rb4
-rw-r--r--spec/lib/gitlab/git/encoding_helper_spec.rb2
-rw-r--r--spec/lib/gitlab/git/repository_spec.rb2
7 files changed, 27 insertions, 27 deletions
diff --git a/lib/gitlab/git/blob.rb b/lib/gitlab/git/blob.rb
index 1325124daf4..4a623311c14 100644
--- a/lib/gitlab/git/blob.rb
+++ b/lib/gitlab/git/blob.rb
@@ -30,7 +30,7 @@ module Gitlab
blob = repository.lookup(blob_entry[:oid])
if blob
- Blob.new(
+ new(
id: blob.oid,
name: blob_entry[:name],
size: blob.size,
@@ -47,7 +47,7 @@ module Gitlab
def raw(repository, sha)
blob = repository.lookup(sha)
- Blob.new(
+ new(
id: blob.oid,
size: blob.size,
data: blob.content(MAX_DATA_DISPLAY_SIZE),
@@ -88,7 +88,7 @@ module Gitlab
end
def submodule_blob(blob_entry, path, sha)
- Blob.new(
+ new(
id: blob_entry[:oid],
name: blob_entry[:name],
data: '',
@@ -140,16 +140,16 @@ module Gitlab
ref = 'refs/heads/' + ref
end
- path_name = PathHelper.normalize_path(file[:path])
+ path_name = Gitlab::Git::PathHelper.normalize_path(file[:path])
# Abort if any invalid characters remain (e.g. ../foo)
- raise Repository::InvalidBlobName.new("Invalid path") if path_name.each_filename.to_a.include?('..')
+ raise Gitlab::Git::Repository::InvalidBlobName.new("Invalid path") if path_name.each_filename.to_a.include?('..')
filename = path_name.to_s
index = repo.index
unless repo.empty?
rugged_ref = repo.references[ref]
- raise Repository::InvalidRef.new("Invalid branch name") unless rugged_ref
+ raise Gitlab::Git::Repository::InvalidRef.new("Invalid branch name") unless rugged_ref
last_commit = rugged_ref.target
index.read_tree(last_commit.tree)
parents = [last_commit]
@@ -161,14 +161,14 @@ module Gitlab
file_entry = index.get(filename)
if action == :rename
- old_path_name = PathHelper.normalize_path(file[:previous_path])
+ old_path_name = Gitlab::Git::PathHelper.normalize_path(file[:previous_path])
old_filename = old_path_name.to_s
file_entry = index.get(old_filename)
index.remove(old_filename) unless file_entry.blank?
end
if file_entry
- raise Repository::InvalidBlobName.new("Filename already exists; update not allowed") unless update
+ raise Gitlab::Git::Repository::InvalidBlobName.new("Filename already exists; update not allowed") unless update
# Preserve the current file mode if one is available
mode = file_entry[:mode] if file_entry[:mode]
diff --git a/lib/gitlab/git/commit.rb b/lib/gitlab/git/commit.rb
index 2077f60a178..d785516ebdd 100644
--- a/lib/gitlab/git/commit.rb
+++ b/lib/gitlab/git/commit.rb
@@ -58,7 +58,7 @@ module Gitlab
obj = if commit_id.is_a?(String)
repo.rev_parse_target(commit_id)
else
- Ref.dereference_object(commit_id)
+ Gitlab::Git::Ref.dereference_object(commit_id)
end
return nil unless obj.is_a?(Rugged::Commit)
@@ -123,7 +123,7 @@ module Gitlab
def diff_from_parent(rugged_commit, options = {})
options ||= {}
break_rewrites = options[:break_rewrites]
- actual_options = Diff.filter_diff_options(options)
+ actual_options = Gitlab::Git::Diff.filter_diff_options(options)
diff = if rugged_commit.parents.empty?
rugged_commit.diff(actual_options.merge(reverse: true))
@@ -211,7 +211,7 @@ module Gitlab
end
def diffs(options = {})
- DiffCollection.new(diff_from_parent(options), options)
+ Gitlab::Git::DiffCollection.new(diff_from_parent(options), options)
end
def parents
diff --git a/lib/gitlab/git/ref.rb b/lib/gitlab/git/ref.rb
index ee559866e04..37ef6836742 100644
--- a/lib/gitlab/git/ref.rb
+++ b/lib/gitlab/git/ref.rb
@@ -33,7 +33,7 @@ module Gitlab
def initialize(repository, name, target)
encode! name
@name = name.gsub(/\Arefs\/(tags|heads)\//, '')
- @dereferenced_target = Commit.find(repository, target)
+ @dereferenced_target = Gitlab::Git::Commit.find(repository, target)
@target = if target.respond_to?(:oid)
target.oid
elsif target.respond_to?(:name)
diff --git a/lib/gitlab/git/repository.rb b/lib/gitlab/git/repository.rb
index 0c75e5da356..963b326a730 100644
--- a/lib/gitlab/git/repository.rb
+++ b/lib/gitlab/git/repository.rb
@@ -32,7 +32,7 @@ module Gitlab
def initialize(path)
@path = path
@name = path.split("/").last
- @attributes = Attributes.new(path)
+ @attributes = Gitlab::Git::Attributes.new(path)
end
# Default branch in the repository
@@ -61,7 +61,7 @@ module Gitlab
def branches
rugged.branches.map do |rugged_ref|
begin
- Branch.new(self, rugged_ref.name, rugged_ref.target)
+ Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target)
rescue Rugged::ReferenceError
# Omit invalid branch
end
@@ -83,12 +83,12 @@ module Gitlab
reload_rugged if force_reload
rugged_ref = rugged.branches[name]
- Branch.new(self, rugged_ref.name, rugged_ref.target) if rugged_ref
+ Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target) if rugged_ref
end
def local_branches
rugged.branches.each(:local).map do |branch|
- Branch.new(self, branch.name, branch.target)
+ Gitlab::Git::Branch.new(self, branch.name, branch.target)
end
end
@@ -123,7 +123,7 @@ module Gitlab
end
end
- Tag.new(self, ref.name, ref.target, message)
+ Gitlab::Git::Tag.new(self, ref.name, ref.target, message)
end.sort_by(&:name)
end
@@ -260,7 +260,7 @@ module Gitlab
# Discard submodules
next if submodule?(entry)
- blob = Blob.raw(self, entry[:oid])
+ blob = Gitlab::Git::Blob.raw(self, entry[:oid])
# Skip binary files
next if blob.data.encoding == Encoding::ASCII_8BIT
@@ -397,7 +397,7 @@ module Gitlab
# diff options. The +options+ hash can also include :break_rewrites to
# split larger rewrites into delete/add pairs.
def diff(from, to, options = {}, *paths)
- DiffCollection.new(diff_patches(from, to, options, *paths), options)
+ Gitlab::Git::DiffCollection.new(diff_patches(from, to, options, *paths), options)
end
# Returns commits collection
@@ -755,7 +755,7 @@ module Gitlab
# create_branch("other-feature", "master")
def create_branch(ref, start_point = "HEAD")
rugged_ref = rugged.branches.create(ref, start_point)
- Branch.new(self, rugged_ref.name, rugged_ref.target)
+ Gitlab::Git::Branch.new(self, rugged_ref.name, rugged_ref.target)
rescue Rugged::ReferenceError => e
raise InvalidRef.new("Branch #{ref} already exists") if e.to_s =~ /'refs\/heads\/#{ref}'/
raise InvalidRef.new("Invalid reference #{start_point}")
@@ -870,7 +870,7 @@ module Gitlab
# Check if this directory exists; if it does, then don't bother
# adding .gitkeep file.
ref = options[:commit][:branch]
- path = PathHelper.normalize_path(path).to_s
+ path = Gitlab::Git::PathHelper.normalize_path(path).to_s
rugged_ref = rugged.ref(ref)
raise InvalidRef.new("Invalid ref") if rugged_ref.nil?
@@ -895,7 +895,7 @@ module Gitlab
update: true
}
- Blob.commit(self, options)
+ Gitlab::Git::Blob.commit(self, options)
end
# Returns result like "git ls-files" , recursive and full file path
@@ -1242,7 +1242,7 @@ module Gitlab
def diff_patches(from, to, options = {}, *paths)
options ||= {}
break_rewrites = options[:break_rewrites]
- actual_options = Diff.filter_diff_options(options.merge(paths: paths))
+ actual_options = Gitlab::Git::Diff.filter_diff_options(options.merge(paths: paths))
diff = rugged.diff(from, to, actual_options)
diff.find_similar!(break_rewrites: break_rewrites)
diff --git a/lib/gitlab/git/tree.rb b/lib/gitlab/git/tree.rb
index 76e3f112e2c..f7450e8b58f 100644
--- a/lib/gitlab/git/tree.rb
+++ b/lib/gitlab/git/tree.rb
@@ -17,7 +17,7 @@ module Gitlab
root_tree = commit.tree
tree = if path
- id = Tree.find_id_by_path(repository, root_tree.oid, path)
+ id = find_id_by_path(repository, root_tree.oid, path)
if id
repository.lookup(id)
else
@@ -28,7 +28,7 @@ module Gitlab
end
tree.map do |entry|
- Tree.new(
+ new(
id: entry[:oid],
root_id: root_tree.oid,
name: entry[:name],
diff --git a/spec/lib/gitlab/git/encoding_helper_spec.rb b/spec/lib/gitlab/git/encoding_helper_spec.rb
index ab8a0b9fba9..83311536893 100644
--- a/spec/lib/gitlab/git/encoding_helper_spec.rb
+++ b/spec/lib/gitlab/git/encoding_helper_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
describe Gitlab::Git::EncodingHelper do
- let(:ext_class) { Class.new { extend EncodingHelper } }
+ let(:ext_class) { Class.new { extend Gitlab::Git::EncodingHelper } }
let(:binary_string) { File.join(SEED_REPOSITORY_PATH, 'gitlab_logo.png') }
describe '#encode!' do
diff --git a/spec/lib/gitlab/git/repository_spec.rb b/spec/lib/gitlab/git/repository_spec.rb
index b99d863a8f6..2a915bf426f 100644
--- a/spec/lib/gitlab/git/repository_spec.rb
+++ b/spec/lib/gitlab/git/repository_spec.rb
@@ -1,7 +1,7 @@
require "spec_helper"
describe Gitlab::Git::Repository, seed_helper: true do
- include EncodingHelper
+ include Gitlab::Git::EncodingHelper
let(:repository) { Gitlab::Git::Repository.new(TEST_REPO_PATH) }