lib/gitlab_git/diff.rb in gitlab_git-10.6.7 vs lib/gitlab_git/diff.rb in gitlab_git-10.6.8
- old
+ new
@@ -19,16 +19,25 @@
# The maximum size before a diff is collapsed.
DIFF_COLLAPSE_LIMIT = 10240 # 10 KB
class << self
def between(repo, head, base, options = {}, *paths)
- # Only show what is new in the source branch compared to the target branch, not the other way around.
- # The linex below with merge_base is equivalent to diff with three dots (git diff branch1...branch2)
- # From the git documentation: "git diff A...B" is equivalent to "git diff $(git-merge-base A B) B"
- common_commit = repo.merge_base_commit(head, base)
+ straight = options.delete(:straight) || false
+ common_commit = if straight
+ base
+ else
+ # Only show what is new in the source branch
+ # compared to the target branch, not the other way
+ # around. The linex below with merge_base is
+ # equivalent to diff with three dots (git diff
+ # branch1...branch2) From the git documentation:
+ # "git diff A...B" is equivalent to "git diff
+ # $(git-merge-base A B) B"
+ repo.merge_base_commit(head, base)
+ end
+
options ||= {}
- break_rewrites = options[:break_rewrites]
actual_options = filter_diff_options(options)
repo.diff(common_commit, head, actual_options, *paths)
end
# Return a copy of the +options+ hash containing only keys that can be