Display empty files properly on MR diffs
This commit is contained in:
parent
e7a6b84168
commit
05dcb2dd76
|
@ -176,6 +176,9 @@ export default {
|
||||||
{{ __('This source diff could not be displayed because it is too large.') }}
|
{{ __('This source diff could not be displayed because it is too large.') }}
|
||||||
<span v-html="viewBlobLink"></span>
|
<span v-html="viewBlobLink"></span>
|
||||||
</div>
|
</div>
|
||||||
|
<div v-if="file.empty" class="nothing-here-block">
|
||||||
|
{{ __('Empty file') }}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ class DiffFileEntity < DiffFileBaseEntity
|
||||||
include IconsHelper
|
include IconsHelper
|
||||||
|
|
||||||
expose :too_large?, as: :too_large
|
expose :too_large?, as: :too_large
|
||||||
|
expose :empty?, as: :empty
|
||||||
expose :added_lines
|
expose :added_lines
|
||||||
expose :removed_lines
|
expose :removed_lines
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Display empty files properly on MR diffs
|
||||||
|
merge_request:
|
||||||
|
author: Sean Nichols
|
||||||
|
type: fixed
|
|
@ -245,6 +245,10 @@ module Gitlab
|
||||||
end
|
end
|
||||||
# rubocop: enable CodeReuse/ActiveRecord
|
# rubocop: enable CodeReuse/ActiveRecord
|
||||||
|
|
||||||
|
def empty?
|
||||||
|
valid_blobs.map(&:empty?).all?
|
||||||
|
end
|
||||||
|
|
||||||
def raw_binary?
|
def raw_binary?
|
||||||
try_blobs(:raw_binary?)
|
try_blobs(:raw_binary?)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue