lib/gitlab_git/repository.rb in gitlab_git-9.0.1 vs lib/gitlab_git/repository.rb in gitlab_git-9.0.2
- old
+ new
@@ -783,12 +783,14 @@
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|
- commit.to_mbox(actual_options)
- end.join("\n")
+ # 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.
@@ -945,10 +947,10 @@
def parse_gitmodules(commit, content)
results = {}
current = ""
content.split("\n").each do |txt|
- if txt.match(/^\s*\[/)
+ if txt =~ /^\s*\[/
current = txt.match(/(?<=").*(?=")/)[0]
results[current] = {}
else
next unless results[current]
match_data = txt.match(/(\w+)\s*=\s*(.*)/)