summaryrefslogtreecommitdiff
path: root/lib/extracts_path.rb
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-01 17:00:28 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2013-10-01 17:00:28 +0300
commitae9dd6276267e0df2d9c2da3b89393e4ee212175 (patch)
tree4db4314bd54eda3bce6b3c67b719f1f5097fb68a /lib/extracts_path.rb
parente219cf7246c6a0495e4507deaffeba11e79f13b8 (diff)
downloadgitlab-ce-ae9dd6276267e0df2d9c2da3b89393e4ee212175.tar.gz
Update code to work with gitlab_git 3
Diffstat (limited to 'lib/extracts_path.rb')
-rw-r--r--lib/extracts_path.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/extracts_path.rb b/lib/extracts_path.rb
index 53bc079296a..5f28d624402 100644
--- a/lib/extracts_path.rb
+++ b/lib/extracts_path.rb
@@ -86,7 +86,6 @@ module ExtractsPath
# - @ref - A string representing the ref (e.g., the branch, tag, or commit SHA)
# - @path - A string representing the filesystem path
# - @commit - A Commit representing the commit from the given ref
- # - @tree - A Tree representing the tree at the given ref/path
#
# If the :id parameter appears to be requesting a specific response format,
# that will be handled as well.
@@ -107,15 +106,18 @@ module ExtractsPath
else
@commit = @repo.commit(@options[:extended_sha1])
end
- @tree = Tree.new(@repo, @commit.id, @ref, @path)
+
@hex_path = Digest::SHA1.hexdigest(@path)
@logs_path = logs_file_project_ref_path(@project, @ref, @path)
- raise InvalidPathError unless @tree.exists?
rescue RuntimeError, NoMethodError, InvalidPathError
not_found!
end
+ def tree
+ @tree ||= Tree.new(@repo, @commit.id, @path)
+ end
+
private
def get_id