lib/gitlab_git/repository.rb in gitlab_git-7.0.0.rc1 vs lib/gitlab_git/repository.rb in gitlab_git-7.0.0.rc2
- old
+ new
@@ -58,11 +58,18 @@
end
# Returns an Array of Tags
def tags
rugged.references.each("refs/tags/*").map do |ref|
- Tag.new(ref.name, ref.target, ref.target.message.chomp)
+ message = nil
+ if ref.target.is_a?(Rugged::Tag::Annotation) &&
+ ref.target.target.is_a?(Rugged::Commit)
+ unless ref.target.target.message == ref.target.message
+ message = ref.target.message.chomp
+ end
+ end
+ Tag.new(ref.name, ref.target, message)
end.sort_by(&:name)
end
# Returns an Array of branch and tag names
def ref_names
@@ -197,11 +204,10 @@
options = default_options.merge(options)
options[:limit] ||= 0
options[:offset] ||= 0
actual_ref = options[:ref] || root_ref
sha = sha_from_ref(actual_ref)
-
build_log(sha, options)
rescue Rugged::OdbError, Rugged::InvalidError, Rugged::ReferenceError
# Return an empty array if the ref wasn't found
[]
end
@@ -725,21 +731,25 @@
walker.push(sha)
commits = []
skipped = 0
current_path = options[:path]
+ current_path = nil if current_path == ''
+ limit = options[:limit].to_i
+ offset = options[:offset].to_i
+
+ walker.sorting(Rugged::SORT_DATE)
walker.each do |c|
- break if options[:limit].to_i > 0 &&
- commits.length >= options[:limit].to_i
+ break if limit > 0 && commits.length >= limit
if !current_path ||
commit_touches_path?(c, current_path, options[:follow])
# This is a commit we care about, unless we haven't skipped enough
# yet
skipped += 1
- commits.push(c) if skipped > options[:offset]
+ commits.push(c) if skipped > offset
end
end
walker.reset