• Vasilii Iakliushin's avatar
    Fix underfined error in Gitlab::Git::Diff · ff128f93
    Vasilii Iakliushin authored
    *Problem*
    
    Gitaly::CommitDelta does not have a `#patch` attribute.
    It leads to the problem that calls to methods `#too_large?`,
    `#collapsed?`, `#has_binary_notice?` and `#to_hash` raise an
    exception.
    
    Here is an example of the exception:
    
    ```
    Failure/Error:
    @too_large = @diff.bytesize >= self.class.patch_hard_limit_bytes
    
    NoMethodError:
     undefined method `bytesize' for nil:NilClass
    ```
    
    *Solution*
    
    I explicitly set `@diff` to have an empty string value if the provided
    payload does not implement `#patch` method.
    ff128f93
diff_spec.rb 9.93 KB