lib/gitlab/client/repositories.rb in gitlab-3.3.0 vs lib/gitlab/client/repositories.rb in gitlab-3.4.0
- old
+ new
@@ -1,7 +1,8 @@
class Gitlab::Client
# Defines methods related to repositories.
+ # @see https://github.com/gitlabhq/gitlabhq/blob/master/doc/api/repositories.md
module Repositories
# Gets a list of project repository tags.
#
# @example
# Gitlab.tags(42)
@@ -17,11 +18,12 @@
alias_method :repo_tags, :tags
# Creates a new project repository tag.
#
# @example
- # Gitlab.create_tag(42,'new_tag','master')
+ # Gitlab.create_tag(42, 'new_tag', 'master')
+ # Gitlab.create_tag(42, 'v1.0', 'master', 'Release 1.0')
#
# @param [Integer] project The ID of a project.
# @param [String] tag_name The name of the new tag.
# @param [String] ref The ref (commit sha, branch name, or another tag) the tag will point to.
# @param [String] message Optional message for tag, creates annotated tag if specified.
@@ -85,9 +87,10 @@
# @param [Integer] project The ID of a project.
# @param [String] filepath The relative path of the file in the repository
# @param [String] ref The name of a repository branch or tag or if not given the default branch.
# @return [String]
def file_contents(project, filepath, ref = 'master')
+ ref = URI.encode(ref, /\W/)
get "/projects/#{project}/repository/blobs/#{ref}?filepath=#{filepath}",
format: nil,
headers: { Accept: 'text/plain' },
parser: ::Gitlab::Request::Parser
end