lib/gitlab_git/repository.rb in gitlab_git-10.2.3 vs lib/gitlab_git/repository.rb in gitlab_git-10.3.0
- old
+ new
@@ -749,34 +749,10 @@
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}")
end
- # Add a tag with +tag_name++ name to the repository in corresponding +ref_target++
- # supports passing a hash of options to create an annotated tag
- #
- # Valid annotation options are:
- # :tagger ::
- # same structure as a committer, the user that is creating the tag
- #
- # :message ::
- # the message to include in the tag annotation
- #
- # Returns a Gitlab::Git::Tag
- def add_tag(tag_name, ref_target, options = nil)
- tag = rugged.tags.create(tag_name, ref_target, options)
- if tag.annotated?
- Tag.new(tag_name, ref_target, tag.annotation.message)
- else
- Tag.new(tag_name, ref_target)
- end
- rescue Rugged::TagError
- raise InvalidRef.new("Tag #{tag_name} already exists")
- rescue Rugged::ReferenceError
- raise InvalidRef.new("Target #{ref_target} is invalid")
- end
-
# Return an array of this repository's remote names
def remote_names
rugged.remotes.each_name.to_a
end
@@ -807,26 +783,10 @@
# Push +*refspecs+ to the remote identified by +remote_name+.
def push(remote_name, *refspecs)
rugged.remotes[remote_name].push(refspecs)
end
- # Return a String containing the mbox-formatted diff between +from+ and
- # +to+. See #diff for the allowed keys in the +options+ hash.
- def format_patch(from, to, options = {})
- options ||= {}
- break_rewrites = options[:break_rewrites]
- actual_options = Diff.filter_diff_options(options)
-
- from_sha = rugged.rev_parse_oid(from)
- to_sha = rugged.rev_parse_oid(to)
- commits_between(from_sha, to_sha).map do |commit|
- # Ignore merge commits, which have more than one parent,
- # in creation of patch to mimic the behavior of `git format-patch`
- commit.to_mbox(actual_options) if commit.parents.length <= 1
- end.flatten.join("\n")
- end
-
# Merge the +source_name+ branch into the +target_name+ branch. This is
# equivalent to `git merge --no_ff +source_name+`, since a merge commit
# is always created.
def merge(source_name, target_name, options = {})
our_commit = rugged.branches[target_name].target
@@ -1169,10 +1129,10 @@
end
nice_cmd + cmd
end
def unsupported_platform?
- %w( darwin freebsd solaris ).map{ |platform| RUBY_PLATFORM.include?(platform) }.any?
+ %w[darwin freebsd solaris].map { |platform| RUBY_PLATFORM.include?(platform) }.any?
end
# Returns true if the index entry has the special file mode that denotes
# a submodule.
def submodule?(index_entry)