Commit 1d3f03fb69111e25a33ccb7f66582904ad0371f8
1 parent
836c870c
Exists in
master
and in
4 other branches
Fix blob and repo stuff after gitlab_git v3
Showing
6 changed files
with
19 additions
and
10 deletions
Show diff stats
app/assets/stylesheets/gitlab_bootstrap/files.scss
app/controllers/projects/blob_controller.rb
app/models/repository.rb
... | ... | @@ -5,7 +5,7 @@ class Repository |
5 | 5 | |
6 | 6 | def initialize(path_with_namespace, default_branch) |
7 | 7 | @path_with_namespace = path_with_namespace |
8 | - @raw_repository = Gitlab::Git::Repository.new(path_to_repo) | |
8 | + @raw_repository = Gitlab::Git::Repository.new(path_to_repo) if path_with_namespace | |
9 | 9 | rescue Gitlab::Git::Repository::NoRepository |
10 | 10 | nil |
11 | 11 | end | ... | ... |
app/views/projects/blob/_download.html.haml
1 | -.file-content.blob_file | |
1 | +.file-content.blob_file.blob-no-preview | |
2 | 2 | %center |
3 | 3 | = link_to project_raw_path(@project, @id) do |
4 | - %div.padded | |
5 | - %h4 | |
6 | - %i.icon-download-alt | |
7 | - %br | |
8 | - Download (#{number_to_human_size blob.size}) | |
4 | + %h1.light | |
5 | + %i.icon-download-alt | |
6 | + %h4 | |
7 | + Download (#{number_to_human_size blob.size}) | ... | ... |
lib/api/repositories.rb
... | ... | @@ -139,7 +139,7 @@ module API |
139 | 139 | path = params[:path] || nil |
140 | 140 | |
141 | 141 | commit = user_project.repository.commit(ref) |
142 | - tree = Tree.new(user_project.repository, commit.id, ref, path) | |
142 | + tree = Tree.new(user_project.repository, commit.id, path) | |
143 | 143 | |
144 | 144 | trees = [] |
145 | 145 | |
... | ... | @@ -168,8 +168,8 @@ module API |
168 | 168 | commit = repo.commit(ref) |
169 | 169 | not_found! "Commit" unless commit |
170 | 170 | |
171 | - blob = Gitlab::Git::Blob.new(repo, commit.id, ref, params[:filepath]) | |
172 | - not_found! "File" unless blob.exists? | |
171 | + blob = Gitlab::Git::Blob.find(repo, commit.id, params[:filepath]) | |
172 | + not_found! "File" unless blob | |
173 | 173 | |
174 | 174 | env['api.format'] = :txt |
175 | 175 | ... | ... |
lib/extracts_path.rb
... | ... | @@ -107,6 +107,8 @@ module ExtractsPath |
107 | 107 | @commit = @repo.commit(@options[:extended_sha1]) |
108 | 108 | end |
109 | 109 | |
110 | + raise InvalidPathError unless @commit | |
111 | + | |
110 | 112 | @hex_path = Digest::SHA1.hexdigest(@path) |
111 | 113 | @logs_path = logs_file_project_ref_path(@project, @ref, @path) |
112 | 114 | ... | ... |