Commit 853ca74620734bb3cfc540e9bf96bfed4f282014
1 parent
00b280c3
Exists in
master
and in
4 other branches
fix typo according to docs and tests
Showing
1 changed file
with
7 additions
and
7 deletions
Show diff stats
lib/api/projects.rb
@@ -37,11 +37,11 @@ module Gitlab | @@ -37,11 +37,11 @@ module Gitlab | ||
37 | # | 37 | # |
38 | # Parameters: | 38 | # Parameters: |
39 | # id (required) - The ID or code name of a project | 39 | # id (required) - The ID or code name of a project |
40 | - # branch_id (required) - The name of the branch | 40 | + # branch (required) - The name of the branch |
41 | # Example Request: | 41 | # Example Request: |
42 | - # GET /projects/:id/repository/branches/:branch_id | ||
43 | - get ":id/repository/branches/:branch_id" do | ||
44 | - @branch = user_project.repo.heads.find { |item| item.name == params[:branch_id] } | 42 | + # GET /projects/:id/repository/branches/:branch |
43 | + get ":id/repository/branches/:branch" do | ||
44 | + @branch = user_project.repo.heads.find { |item| item.name == params[:branch] } | ||
45 | present @branch, :with => Entities::RepoObject | 45 | present @branch, :with => Entities::RepoObject |
46 | end | 46 | end |
47 | 47 | ||
@@ -148,7 +148,7 @@ module Gitlab | @@ -148,7 +148,7 @@ module Gitlab | ||
148 | # | 148 | # |
149 | # Parameters: | 149 | # Parameters: |
150 | # id (required) - The ID or code name of a project | 150 | # id (required) - The ID or code name of a project |
151 | - # sha (required) - The commit or branch name | 151 | + # sha (required) - The commit or branch name |
152 | # filepath (required) - The path to the file to display | 152 | # filepath (required) - The path to the file to display |
153 | # Example Request: | 153 | # Example Request: |
154 | # GET /projects/:id/repository/commits/:sha/blob | 154 | # GET /projects/:id/repository/commits/:sha/blob |
@@ -157,10 +157,10 @@ module Gitlab | @@ -157,10 +157,10 @@ module Gitlab | ||
157 | 157 | ||
158 | commit = user_project.commit ref | 158 | commit = user_project.commit ref |
159 | error!('404 Commit Not Found', 404) unless commit | 159 | error!('404 Commit Not Found', 404) unless commit |
160 | - | 160 | + |
161 | tree = Tree.new commit.tree, user_project, ref, params[:filepath] | 161 | tree = Tree.new commit.tree, user_project, ref, params[:filepath] |
162 | error!('404 File Not Found', 404) unless tree.try(:tree) | 162 | error!('404 File Not Found', 404) unless tree.try(:tree) |
163 | - | 163 | + |
164 | if tree.text? | 164 | if tree.text? |
165 | encoding = Gitlab::Encode.detect_encoding(tree.data) | 165 | encoding = Gitlab::Encode.detect_encoding(tree.data) |
166 | content_type encoding ? "text/plain; charset=#{encoding}" : "text/plain" | 166 | content_type encoding ? "text/plain; charset=#{encoding}" : "text/plain" |