diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-30 11:40:06 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-06-30 11:40:06 +0000 |
commit | 6b3f0a47a2410b5a2a9fc1e78ff2d006b05a3e05 (patch) | |
tree | bd4e2f1b1eabdca0f546685e9df8b5a0b649940c /lib/gitlab/git | |
parent | 76b84b42f64b8009cc181d5da0c656a8a521986d (diff) | |
download | gitlab-ce-6b3f0a47a2410b5a2a9fc1e78ff2d006b05a3e05.tar.gz |
Add latest changes from gitlab-org/security/gitlab@14-0-stable-ee
Diffstat (limited to 'lib/gitlab/git')
-rw-r--r-- | lib/gitlab/git/diff.rb | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/gitlab/git/diff.rb b/lib/gitlab/git/diff.rb index 53df0b7b389..8325eadce2f 100644 --- a/lib/gitlab/git/diff.rb +++ b/lib/gitlab/git/diff.rb @@ -33,6 +33,8 @@ module Gitlab SERIALIZE_KEYS = %i(diff new_path old_path a_mode b_mode new_file renamed_file deleted_file too_large).freeze + BINARY_NOTICE_PATTERN = %r(Binary files a\/(.*) and b\/(.*) differ).freeze + class << self def between(repo, head, base, options = {}, *paths) straight = options.delete(:straight) || false @@ -131,8 +133,13 @@ module Gitlab def patch_hard_limit_bytes Gitlab::CurrentSettings.diff_max_patch_bytes end - end + def has_binary_notice?(text) + return false unless text.present? + + text.start_with?(BINARY_NOTICE_PATTERN) + end + end def initialize(raw_diff, expanded: true) @expanded = expanded @@ -215,7 +222,7 @@ module Gitlab end def has_binary_notice? - @diff.start_with?('Binary') + self.class.has_binary_notice?(@diff) end private |